__stormcenter=function(){this.fullDayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]};__stormcenter.prototype.loadStormCenter=function(){this.outsideBoundsMessage=null;this.howSorted=new Array();this.checkBrowserCompatibility();this.readConfigFromCookies();this.ensureControlStates();var A=iFactor.common.getArguments()["x"];var H=iFactor.common.getArguments()["y"];var G=parseInt(iFactor.common.config.opacity)/100;this.current_outage_indices=new Array();this.current_outage_level=0;this.simpleAreasRendered=new Array();this.setMapDivSize();this.lastZoom=new Array(null,null);this.validCharacters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,";this.radioLayerNames=[];this.toggleLayerNames=[];this.timerId=null;this.setFavoritesOptions();this.pointLayerNames=new Object();this.pointLayerNames=["outages","thematic","serviceareas"];this.pointLayers=new Object();this.tabshow("legend");this.zoomLevelPointLayers=null;try{if(window.document.getElementById("token")){var C=window.document.getElementById("token").innerHTML}this.map=new VEMap("map");if(C!=null&&C!=""){this.map.SetClientToken(C)}}catch(F){alert("The map is currently unavailable. Please wait a few moments and refresh your browser window.");return }var D=this.getStartLatLngZoom();var E=new VELatLong(D[0],D[1]);if(this.map.EnableShapeDisplayThreshold){this.map.EnableShapeDisplayThreshold(false)}this.map.SetDashboardSize(VEDashboardSize.Normal);var B=new VEMapOptions();B.EnableBirdseye=false;this.map.LoadMap(E,D[2],iFactor.common.config.map_type,null,null,false,null,B);this.loadTileLayers(false,G);this.map.AttachEvent("onchangeview",function(){iFactor.StormCenter.onMapPan()});this.map.AttachEvent("onchangemapstyle",function(){iFactor.StormCenter.saveMapState()});this.map.AttachEvent("onmouseover",function(I){iFactor.StormCenter.mouseShapeHandler(I)});this.map.AttachEvent("onmouseout",function(I){iFactor.StormCenter.mouseShapeHandler(I)});this.map.AttachEvent("ontokenexpire",function(I){iFactor.StormCenter.handleTokenExpire(I)});this.map.AttachEvent("ontokenerror",function(I){iFactor.StormCenter.handleTokenError(I)});this.providerChartPanel=null;if((A!=null)&&(A!="")&&(H!=null)&&(H!="")){this.zoomToForeignXY(A,H)}else{this.onMapPan()}};__stormcenter.prototype.handleTokenExpire=function(B){try{}catch(A){}};__stormcenter.prototype.handleTokenError=function(B){try{}catch(A){}};__stormcenter.prototype.mouseShapeHandler=function(B){if(B.elementID){var A=this.map.GetShapeByID(B.elementID);if(A.GetDescription()&&A.GetType()=="Polygon"){if(B.eventName=="onmouseover"){this.map.HideInfoBox();this.map.ShowInfoBox(A)}}}};__stormcenter.prototype.getStartLatLngZoom=function(){var B=new Array();B[0]=parseFloat(iFactor.common.config.start_lat);B[1]=parseFloat(iFactor.common.config.start_long);B[2]=parseInt(iFactor.common.config.start_zoom);var A=iFactor.common.config.homepage;var C=null;if((A!=null)&&(A!="")){C=A.split(",");B[0]=parseFloat(C[0]);B[1]=parseFloat(C[1]);B[2]=parseInt(C[2])}return B};__stormcenter.prototype.loadTileLayers=function(D,E){var C=0;var B=null;var A=E;if(A==null){A=this.getOpacity()}if(!D){this.tileLayers=new Array();for(C=0;C<this.toggleLayerNames.length;C++){B=this.toggleLayerNames[C];this.addTileLayer(B,0.5,iFactor.common.getToggleValue(B))}}for(C=0;C<this.radioLayerNames.length;C++){B=this.radioLayerNames[C];this.addTileLayer(B,A,iFactor.common.isRadioButtonSelected(B,this.radioName))}};__stormcenter.prototype.getOpacity=function(){return(this.slider.getValue()/100)};__stormcenter.prototype.addTileLayer=function(B,F,D){var C=new VETileSourceSpecification(B,"images/tiles/"+B+"/%4.png");var E=parseInt(iFactor.common.config.min_tile_zoom_level);var A=parseInt(iFactor.common.config.max_tile_zoom_level);C.Opacity=F;C.ZIndex=100;C.MaxZoom=A;C.MinZoom=E;this.tileLayers[B]=C;this.map.AddTileLayer(C);this.toggleTileLayer(D,B)};__stormcenter.prototype.toggleTileLayer=function(A,B){if(A){this.map.ShowTileLayer(B)}else{this.map.HideTileLayer(B)}this.saveMapState()};__stormcenter.prototype.checkBrowserCompatibility=function(){var A=iFactor.common.getBrowserType();if(A=="Other"){window.location="notsupported.html"}if(A=="Firefox15"){Msn.Drawing.Graphic.CreateGraphic=function(C,B){return new Msn.Drawing.SVGGraphic(C,B)}}};__stormcenter.prototype.ensureControlStates=function(){this.toggleIfNecessary("showoutages","true");this.toggleIfNecessary("showthematic","true");this.toggleIfNecessary("showserviceareas","true");var A=["favoritename","address_value"];var B=0;var D=window.document;var C=null;for(B=0;B<A.length;B++){if(D.getElementById(A[B])!=null){D.getElementById(A[B]).value=""}}};__stormcenter.prototype.toggleIfNecessary=function(C,A){var B=window.document.getElementById(C);if(A!=null&&B!=null){A=(A.toLowerCase()=="true");B.checked=A}};__stormcenter.prototype.readConfigFromCookies=function(){var B=iFactor.common.readCookie("state");var A=0;var C=null;if((B!=null)&&(B!="")){var D=B.split("|");for(A=0;A<D.length;A++){C=D[A].split(":");iFactor.common.config[C[0]]=C[1]}}};__stormcenter.prototype.setMapDivSize=function(){if(window.innerWidth){myWidth=window.innerWidth}else{if(document.documentElement.clientWidth==0){myWidth=document.body.clientWidth}else{myWidth=document.documentElement.clientWidth}}if(window.innerHeight){myHeight=window.innerHeight}else{if(document.documentElement.clientHeight==0){myHeight=document.body.clientHeight}else{myHeight=document.documentElement.clientHeight}}var A=myHeight-80;var B=myWidth-242;if((document.getElementById)&&(!document.all)){A=A+"px";B=B+"px"}window.document.getElementById("map").style.height=A;window.document.getElementById("map").style.width=B};__stormcenter.prototype.mapResize=function(){if(window.innerWidth){myWidth=window.innerWidth}else{if(document.documentElement.clientWidth==0){myWidth=document.body.clientWidth}else{myWidth=document.documentElement.clientWidth}}if(window.innerHeight){myHeight=window.innerHeight}else{if(document.documentElement.clientHeight==0){myHeight=document.body.clientHeight}else{myHeight=document.documentElement.clientHeight}}var A=myHeight-80;var B=myWidth-257;if((document.getElementById)&&(!document.all)){A=A+"px";B=B+"px";window.document.getElementById("map").style.height=A;window.document.getElementById("map").style.width=B}else{this.map.Resize(B,A)}};__stormcenter.prototype.tabshow=function(D){var F=document.getElementById(D+"_tab");var H=document.getElementById(D+"_content");if(D=="legend"){if(window.document.getElementById("showthematic").checked){H=document.getElementById("thematic_content")}}var E=F.parentNode.getElementsByTagName("LI");var C=E.length;for(var G=0;G<C;G++){if(E[G].id==F.id){E[G].className="on"}else{E[G].className=""}}var B=H.parentNode.getElementsByTagName("DIV");var A=B.length;for(var G=0;G<A;G++){if(B[G].className=="showheadlines"){if(B[G].id==H.id){B[G].style.display="block"}else{B[G].style.display="none"}}}};__stormcenter.prototype.showCustomerChartPanel=function(){var A="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='560px' height='585px' id='customerfusionchart'>";A=A+"<param name='movie' value='flashcharts/FC_2_3_MSColumnLine_DY_2D.swf'/>";A=A+"<param name='FlashVars' value='&dataURL="+iFactor.common.config.data_directory+"/customerchart.xml&chartWidth=560&chartHeight=585'/>";A=A+"<param name='quality' value='high'/>";A=A+"<param name='bgcolor' value='#FFFFFF'/>";A=A+"<embed src='flashcharts/FC_2_3_MSColumnLine_DY_2D.swf' flashvars='&dataURL="+iFactor.common.config.data_directory+"/customerchart.xml' quality='high' bgcolor='#FFFFFF' width='560px' height='585px' name='customerfusionchart' type='application/x-shockwave-flash' pluginspace='http://www.macromedia.com/go/getflashplayer'></embed>";A=A+"</object>";if(this.customerChartPanel==null){this.customerChartPanel=this.getNewChart("customerchart")}this.customerChartPanel.setBody(A);this.customerChartPanel.render();this.customerChartPanel.show()};__stormcenter.prototype.getNewChart=function(C){window.document.getElementById(C).style.display="inline";var A=iFactor.common.getBrowserType();var B=null;var E=null;var G=null;var F=null;var H=iFactor.common.getInnerWindowDimensions();var D=null;B=570;E=620;G=Math.round((H[1]-E)/2);F=Math.round((H[0]-B)/2);if(G<=10){G=10}B=B+"px";E=E+"px";D=new YAHOO.widget.Panel(C,{width:B,height:E,x:F,y:G,close:true,zIndex:20000});return D};__stormcenter.prototype.onMapPan=function(){this.cancelTimer();var A=this.ensureZoomLevel();if(A!=this.map.GetZoomLevel()){this.map.SetCenterAndZoom(this.map.GetCenter(),A)}if(this.inAllowableBounds()){this.storeBounds();this.updateStatusArea();this.updatePointLayers();this.controlLayerVisibility();this.startTimer()}else{this.returnToLastBounds()}this.saveMapState();this.outsideBoundsMessage=null};__stormcenter.prototype.controlLayerVisibility=function(){var H=iFactor.common.config.thematic_default_display;var F=parseInt(iFactor.common.config.thematic_threshold);var K=parseInt(iFactor.common.config.thematic_min_zoom);var B=parseInt(iFactor.common.config.thematic_max_zoom);var I=parseInt(iFactor.common.config.service_area_border_min_zoom);var A=parseInt(iFactor.common.config.service_area_border_max_zoom);var G=window.document;var C=G.getElementById("num_outages_text").innerHTML;var E=parseInt(C.split(" ")[2]);var J=this.map.GetZoomLevel();var D=(J>=K)&&(J<=B);if(D&&(H=="on"||(H=="auto"&&E>=F))){this.toggleIfNecessary("showthematic","true");this.toggleIfNecessary("showoutages","false");this.showHideSafely("thematic","show");this.showHideSafely("outages","hide")}else{this.toggleIfNecessary("showthematic","false");this.toggleIfNecessary("showoutages","true");this.showHideSafely("thematic","hide");this.showHideSafely("outages","show")}this.updateLegend();if((J>=I)&&(J<=A)){this.toggleIfNecessary("showserviceareas","true");this.showHideSafely("serviceareas","show")}else{this.toggleIfNecessary("showserviceareas","false");this.showHideSafely("serviceareas","hide")}};__stormcenter.prototype.updateLegend=function(){var A=document.getElementById("legend_tab");if(A.className=="on"){this.tabshow("legend")}};__stormcenter.prototype.showHideSafely=function(A,B){if(this.pointLayers[A]!=null){if(B=="show"){this.pointLayers[A].Show()}else{this.pointLayers[A].Hide()}}};__stormcenter.prototype.updatePointLayers=function(){var A=null;var B=0;if(this.isZoomLevelChanged()){this.zoomLevelPointLayers=new Array()}for(B=0;B<this.pointLayerNames.length;B++){A=this.pointLayerNames[B];if(A=="outages"){this.readPointLayer(A)}else{if(A=="thematic"){this.readSimplePointLayer(A)}else{if(A=="serviceareas"){this.readStaticPointLayer(A)}}}}};__stormcenter.prototype.readPointLayer=function(A){var D=this.pointLayers[A];var B=0;var E=null;if((D!=null)&&(this.isZoomLevelChanged()||!this.isLayerRendered(A))){D.DeleteAllShapes()}toRequest=iFactor.common.config.data_directory+"/"+A+"/metadata.xml";toRequest=toRequest+iFactor.common.uniqueRequestTag(true);var C=iFactor.common.createXMLRequest();C.onreadystatechange=function(){iFactor.StormCenter.doReadPointLayer(C,A)};C.open("GET",toRequest,true);C.send(null)};__stormcenter.prototype.readSimplePointLayer=function(A){var D=this.pointLayers[A];var B=0;var E=null;toRequest=iFactor.common.config.data_directory+"/"+A+"/metadata.xml";toRequest=toRequest+iFactor.common.uniqueRequestTag(true);var C=iFactor.common.createXMLRequest();C.onreadystatechange=function(){iFactor.StormCenter.doReadSimplePointLayer(C,A)};C.open("GET",toRequest,true);C.send(null)};__stormcenter.prototype.isZoomLevelChanged=function(){var A=true;if(this.map.GetZoomLevel()==this.current_outage_indices_zoomlevel){A=false}return A};__stormcenter.prototype.isLayerRendered=function(A){var B=false;for(i=0;i<this.zoomLevelPointLayers.length;i++){if(this.zoomLevelPointLayers[i]==A){B=true}}return B};__stormcenter.prototype.readStaticPointLayer=function(A){if(this.pointLayers[A]==null){toRequest=iFactor.common.config.data_static_directory+"/"+A+"/metadata.xml";toRequest=toRequest+iFactor.common.uniqueRequestTag(true);var B=iFactor.common.createXMLRequest();B.onreadystatechange=function(){iFactor.StormCenter.doReadStaticPointLayer(B,A)};B.open("GET",toRequest,true);B.send(null)}};__stormcenter.prototype.doReadPointLayer=function(C,H){if((C.readyState==4)&&(C.status!=404)){var A=C.responseXML.getElementsByTagName("directory")[0];var L=iFactor.common.getXMLNodeValue(A);var F=0;var D=null;var E=null;var M=null;var G=window.document.getElementById("show"+H).checked;var K=new Array();var B=this.map.GetZoomLevel();L=iFactor.common.config.data_directory+"/"+H+"/"+L+"/";K=this.getMapSpatialIndices(B);var N=false;if(this.isZoomLevelChanged()||!this.isLayerRendered(H)){for(F=0;F<K.length;F++){D=L+K[F]+".xml";this.importPointLayer(D,H,G)}this.current_outage_indices=K;this.current_outage_indices.length=B;this.zoomLevelPointLayers[this.zoomLevelPointLayers.length]=H}else{var I=this.current_outage_indices.length;var J=0;for(F=0;F<K.length;F++){var N=false;for(j=0;j<I;j++){if(this.current_outage_indices[j]==K[F]){N=true}}if(!N){D=L+K[F]+".xml";this.importPointLayer(D,H,G);J+=1;this.current_outage_indices[I+J]=K[F]}}}this.current_outage_indices_zoomlevel=this.map.GetZoomLevel()}};__stormcenter.prototype.doReadSimplePointLayer=function(D,I){if((D.readyState==4)&&(D.status!=404)){if(!this.simpleAreasRendered[I]&&I!="thematic"){var C=D.responseXML.getElementsByTagName("directory")[0];var B=iFactor.common.getXMLNodeValue(C);var G=0;var K=iFactor.common.config.data_directory+"/"+I+"/"+B+"/";var E=null;var F=null;var J=null;var H=window.document.getElementById("show"+I).checked;E=K+"thematic_areas.xml";this.importPointLayer(E,I,H);this.simpleAreasRendered[I]=true}if(I=="thematic"){var C=D.responseXML.getElementsByTagName("directory")[0];var B=iFactor.common.getXMLNodeValue(C);var G=0;var K=iFactor.common.config.data_directory+"/"+I+"/"+B+"/";var E=null;var F=null;var J=null;var H=window.document.getElementById("show"+I).checked;var A=this.pointLayers[I];if(A!=null){A.DeleteAllShapes()}E=K+"thematic_areas.xml";this.importPointLayer(E,I,H);this.simpleAreasRendered[I]=true}}};__stormcenter.prototype.doReadStaticPointLayer=function(C,H){if((C.readyState==4)&&(C.status!=404)){var B=C.responseXML.getElementsByTagName("directory")[0];var A=iFactor.common.getXMLNodeValue(B);var F=0;dirNameStatic=iFactor.common.config.data_static_directory+"/"+H+"/"+A+"/";var D=null;var E=null;var I=null;var G=window.document.getElementById("show"+H).checked;if(H=="serviceareas"){D=dirNameStatic+"serviceareas.xml";this.importPointLayer(D,H,G)}}};__stormcenter.prototype.importPointLayer=function(C,D,A){var B=iFactor.common.createXMLRequest();B.onreadystatechange=function(){iFactor.StormCenter.doImportPointLayer(B,C,D,A)};B.open("GET",C,true);B.send(null)};__stormcenter.prototype.doImportPointLayer=function(B,C,D,A){if((B.readyState==4)&&(B.status!=404)){var F=D;var E=this.pointLayers[F];if(E==null){E=new VEShapeLayer();this.pointLayers[F]=E}if(!A){E.Hide()}this.map.ShowMessageBox=false;aSource=new VEShapeSourceSpecification(VEDataType.GeoRSS,C,E);this.map.ImportShapeLayerData(aSource,function(G){iFactor.StormCenter.pointLayerLoaded(G,D)},false)}};__stormcenter.prototype.zoomIntoIcon=function(C,B){var E=new VELatLong(C,B);var A=this.map.GetZoomLevel()+3;var D=parseInt(iFactor.common.config.min_zoom_level);if(A>D){A=D}this.map.SetCenterAndZoom(E,A)};__stormcenter.prototype.gotoAreaLatLng=function(){var C=window.document.getElementById("areaselect");var B=C.options[C.selectedIndex].text;var F=window.document.getElementById("areaselect").value.split(",");var E=new VELatLong(F[0],F[1]);var A=parseInt(iFactor.common.config.area_zoom_level);var D=parseInt(iFactor.common.config.min_zoom_level);if(A>D){A=D}this.map.SetCenterAndZoom(E,A)};__stormcenter.prototype.gotoLatLng=function(C,B){var E=new VELatLong(C,B);var A=parseInt(iFactor.common.config.area_zoom_level);var D=parseInt(iFactor.common.config.min_zoom_level);if(A>D){A=D}this.map.SetCenterAndZoom(E,A)};__stormcenter.prototype.zoomToThematicArea=function(B,A){var C=new VELatLong(B,A);this.map.SetCenterAndZoom(C,10)};__stormcenter.prototype.pointLayerLoaded=function(B,D){var K=B.GetShapeCount();var C=0;var I=null;var F=null;var H=null;var J=null;for(C=0;C<K;C++){I=B.GetShapeByIndex(C);try{I.SetCustomIcon("<img src='"+I.IconId+"'/>")}catch(E){}try{J=I.IconId;J=J.split(".")[0];J=J.split("/")[1];H=iFactor.common.config[J+"_color"];if(H!=null){H=iFactor.common.convertHex2DecRGB(H);var G=new VEColor(parseInt(H[0]),parseInt(H[1]),parseInt(H[2]),0.5);if(J=="thematic_0"){G=new VEColor(255,255,255,0)}I.SetFillColor(G);if(D=="serviceareas"){var A=parseInt(iFactor.common.config.service_area_border_width);G=new VEColor(parseInt(H[0]),parseInt(H[1]),parseInt(H[2]),0.5);I.SetLineWidth(A)}else{if(D=="thematic"){H=iFactor.common.convertHex2DecRGB(iFactor.common.config.thematic_border_color);G=new VEColor(parseInt(H[0]),parseInt(H[1]),parseInt(H[2]),0.5);I.SetLineColor(G);parseInt(iFactor.common.config.thematic_border_width);var A=parseInt(iFactor.common.config.thematic_border_width);I.SetLineWidth(A)}else{G=new VEColor(100,100,100,0.4);I.SetLineColor(G);I.SetLineWidth(1)}}}}catch(E){}}};__stormcenter.prototype.getSpatialIndexForLngLatZoom=function(K,J,B){var C=-85.05112878;var H=85.05112878;var E=-180;var I=180;var L="";var G=null;var A=0;var F=0;var D=0;var N=new Array();var M=["0","1","2","3"];for(F=0;F<B;F++){A=0;if(J<((H+C)/2)){A=A+2;H=(H+C)/2}else{C=(H+C)/2}if(K>((I+E)/2)){A=A+1;E=(I+E)/2}else{I=(I+E)/2}L=L+A}return L};__stormcenter.prototype.getSpatialIndicesForPoint=function(E,B){var C=-85.05112878;var I=85.05112878;var F=-180;var J=180;var K=E.Latitude;var L=E.Longitude;var M="";var H=null;var A=0;var G=0;var D=0;var O=new Array();var N=["0","1","2","3"];for(G=0;G<B;G++){A=0;if(K<((I+C)/2)){A=A+2;I=(I+C)/2}else{C=(I+C)/2}if(L>((J+F)/2)){A=A+1;F=(J+F)/2}else{J=(J+F)/2}M=M+A}if(M.length>1){M=M.substr(0,M.length-2);for(G=0;G<N.length;G++){for(D=0;D<N.length;D++){O[O.length]=M+N[G]+N[D]}}}else{O=N}O=this.getModifiedSpatialIndices(O);return O};__stormcenter.prototype.getModifiedSpatialIndices=function(A){var B=null;if(A.length>0){B=A[0];if(B.length==6){A=new Array();A[0]="xxxxxx"}else{if(B.length==7){A=new Array();A[0]="xxxxxxx"}}}return A};__stormcenter.prototype.getMapSpatialIndices=function(D){var A=this.map;var F=this.map.LatLongToPixel(this.map.GetCenter());var I=this.map.GetLeft();var P=this.map.GetTop();var M=2*F.x-I;var J=2*F.y-P;var H=new Array();var L=new Array();H[0]=this.map.PixelToLatLong(new VEPixel(I,P));H[1]=this.map.PixelToLatLong(new VEPixel(I,J));H[2]=this.map.PixelToLatLong(new VEPixel(M,P));H[3]=this.map.PixelToLatLong(new VEPixel(M,J));var C=6;var O=(H[3].Longitude-H[0].Longitude)/(C-1);var N=(H[0].Latitude-H[3].Latitude)/(C-1);var G=null;var K=null;var B=null;var E=0;for(i=0;i<C;i++){K=H[0].Longitude+i*O;for(j=0;j<C;j++){G=H[3].Latitude+j*N;B=this.getSpatialIndexForLngLatZoom(K,G,D-1);isNew=true;E=-1;while(isNew&&(E++<L.length)){if(L[E]==B){isNew=false}}if(isNew){L[L.length]=B}}}L=this.getModifiedSpatialIndices(L);return L};__stormcenter.prototype.inAllowableBounds=function(){var J=this.map.GetZoomLevel();var H=this.map.GetCenter().Latitude;var D=this.map.GetCenter().Longitude;var C=parseInt(iFactor.common.config.min_zoom_level);var I=parseInt(iFactor.common.config.max_zoom_level);var E=parseFloat(iFactor.common.config.min_viewable_lat);var G=parseFloat(iFactor.common.config.max_viewable_lat);var F=parseFloat(iFactor.common.config.min_viewable_lng);var A=parseFloat(iFactor.common.config.max_viewable_lng);var B=true;if((J>C)||(J<I)){B=false}if(iFactor.common.config.allow_zoom!=null){B=true;iFactor.common.config.allow_zoom=null}if((H>G)||(H<E)){B=false}if((D>A)||(D<F)){B=false}return B};__stormcenter.prototype.storeBounds=function(){this.lastZoom[0]=this.map.GetCenter();this.lastZoom[1]=this.map.GetZoomLevel()};__stormcenter.prototype.returnToLastBounds=function(){if(this.outsideBoundsMessage!=null){window.alert(this.outsideBoundsMessage);this.outsideBoundsMessage=null}this.map.SetCenterAndZoom(this.lastZoom[0],this.lastZoom[1])};__stormcenter.prototype.setLastUpdated=function(){var B=document.getElementById("last_updated");var A=new Date();var C="<b>Last Updated:</b> "+this.reallyShortDateAndTime(A);B.innerHTML=C};__stormcenter.prototype.reallyShortDateAndTime=function(D){var C=this.shortDay(D.getDay())+", ";var B="AM";var A=D.getHours();if(A>12){B="PM";A=A-12}if(A==0){A=12}C=C+A+":";A=D.getMinutes()+"";if(A.length==1){A="0"+A}C=C+A+B;return C};__stormcenter.prototype.shortDay=function(A){var B=this.fullDayNames[A];return B.substring(0,3)};__stormcenter.prototype.updateStatusArea=function(){var E=iFactor.common.createXMLRequest();var A=iFactor.common.config.data_directory+"/data.xml";var G=window.document;A=A+iFactor.common.uniqueRequestTag(true);A=A.fixUrlSeparator();E.open("GET",A,false);E.send(null);if((E.readyState==4)&&(E.status!=404)){var D=E.responseXML;var C=D.getElementsByTagName("total_outages").item(0);G.getElementById("num_outages_text").innerHTML="<b>Active Outages:</b> "+iFactor.common.getXMLNodeValue(C);C=D.getElementsByTagName("total_customers").item(0);G.getElementById("num_custs_text").innerHTML="<b>Affected Customers:</b> "+iFactor.common.getXMLNodeValue(C);C=D.getElementsByTagName("date_generated").item(0);G.getElementById("last_updated").innerHTML="<b>Last Updated:</b> "+iFactor.common.getXMLNodeValue(C);C=D.getElementsByTagName("storm_mode").item(0);var F=iFactor.common.getXMLNodeValue(C);C=D.getElementsByTagName("servlet_interval").item(0);var B=iFactor.common.getXMLNodeValue(C);if(F=="false"){G.getElementById("servlet_interval").innerHTML="<br/><i>"+B+"</i>";G.getElementById("storm_interval").innerHTML="<i></i>"}else{G.getElementById("storm_interval").innerHTML="<i>"+B+"</i>";G.getElementById("servlet_interval").innerHTML="<br/><i></i>"}}};__stormcenter.prototype.cancelTimer=function(){var A=this.timerId;if(A!=null){window.clearInterval(A);this.timerId=null}};__stormcenter.prototype.startTimer=function(){var B=function(){iFactor.StormCenter.onMapPan()};var A=parseInt(iFactor.common.config.update_interval)*1000;this.timerId=window.setInterval(B,A)};__stormcenter.prototype.zoomToForeignXY=function(J,I){var F=this.getHostRoot()+"/"+iFactor.common.config.servlet_path;F=F+"service=transform";F=F+"&y="+I;F=F+"&x="+J;F=F+"&target=EPSG:32104&source=EPSG:4326&multiplier=1";var D=iFactor.common.createXMLRequest();var C=F+iFactor.common.uniqueRequestTag(false);C=C.fixUrlSeparator();var G=this;D.open("GET",C,false);D.send(null);if((D.readyState==4)&&(D.status!=404)){var B=D.responseXML.getElementsByTagName("coordinate").item(0);var A=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(B,"x"));var H=parseFloat(A).toFixed(0);A=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(B,"y"));var E=parseFloat(A).toFixed(0)}this.map.SetCenterAndZoom(new VELatLong(E,H),12)};__stormcenter.prototype.showHelpPanel=function(){if(this.helpPanel==null){window.document.getElementById("helppanel").style.display="inline";var E=iFactor.common.getInnerWindowDimensions();var A=460;var B=370;var D=Math.round((E[1]-B)/2);var C=Math.round((E[0]-A)/2);if(D<=10){D=10}A=A+"px";B=B+"px";this.helpPanel=new YAHOO.widget.Panel("helppanel",{width:A,height:B,x:C,y:D,close:true,zIndex:20000})}this.helpPanel.render();this.helpPanel.show()};__stormcenter.prototype.showCustomerTablePanel=function(){if(this.customerTablePanel==null){var B=window.document.getElementById("areatablescroll");B.style.width="385px";B.style.height="315px";window.document.getElementById("customertable").style.display="inline";var F=iFactor.common.getInnerWindowDimensions();var A=395;var C=385;var E=Math.round((F[1]-C)/2);var D=Math.round((F[0]-A)/2);if(E<=10){E=10}A=A+"px";C=C+"px";this.customerTablePanel=new YAHOO.widget.Panel("customertable",{width:A,height:C,x:D,y:E,close:true,zIndex:20000})}this.populateCustomerTable();this.customerTablePanel.render();this.customerTablePanel.show()};__stormcenter.prototype.populateCustomerTable=function(){var B=iFactor.common.createXMLRequest();var A=iFactor.common.config.data_directory+"/data.xml";A=A+iFactor.common.uniqueRequestTag(true);A=A.fixUrlSeparator();B.open("GET",A,false);B.send(null);if((B.readyState==4)&&(B.status!=404)){this.setCustomerTableData(B.responseXML)}};__stormcenter.prototype.setCustomerTableData=function(D){var C=D.getElementsByTagName("area");var G=window.document.getElementById("data_grid");var F=0;var B=true;var E=new Array(0,0);while(B){try{G.deleteRow(0)}catch(H){B=false}}var A="";for(F=0;F<C.length;F++){A=A+this.tableRowForArea(C[F],G);this.addMoreTotals(C[F],E)}this.sortCustomerTable("data_grid",0);this.sortCustomerTable("data_grid",0)};__stormcenter.prototype.addMoreTotals=function(A,C){var B=parseInt(iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(A,"custs_out")));var D=parseInt(iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(A,"total_custs")));C[0]=C[0]+B;C[1]=C[1]+D};__stormcenter.prototype.tableRowForArea=function(B,D){var F=D.insertRow(D.length);var A=F.insertCell(0);this.setCellStyle(A.style,"140px");A.innerHTML=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(B,"area_name"));A=F.insertCell(1);this.setCellStyle(A.style,"110px");var C=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(B,"custs_out"));A.innerHTML=C;A=F.insertCell(2);this.setCellStyle(A.style,"105px");var E=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(B,"total_custs"));A.innerHTML=E};__stormcenter.prototype.setCellStyle=function(A,B){A.width=B;A.padding="2px 0px 2px 3px";A.margin="0px";A.borderBottom="1px solid #b8b8b8";A.borderRight="1px solid #b8b8b8";A.height="16px";A.overflow="hidden";A.fontSize="11px";A.fontFamily="verdana, arial, helvetica, sans-serif";A.lineHeight="12px";A.backgroundColor="#ffffff"};__stormcenter.prototype.sortCustomerTable=function(I,E){var B=this.howToSort(E);this.howSorted[E]=B;var A=window.document.getElementById(I);var K=A.rows;var F=0;var D=0;var J=null;var H=null;var G=new Array();var C=null;for(F=0;F<K.length;F++){J=K.item(F).cells;H=new Array();for(D=0;D<J.length;D++){H[D]=J.item(D).innerHTML}if((H.length>0)&&(H[0].toLowerCase()=="<b>totals</b>")){C=H}else{this.addSorted(H,E,G)}}if(B){G.reverse()}if(C!=null){G[G.length]=C}for(F=0;F<G.length;F++){H=G[F];J=K.item(F).cells;for(D=0;D<J.length;D++){J.item(D).innerHTML=H[D]}}this.setColumnHeader(E,B)};__stormcenter.prototype.addSorted=function(B,C,A){var E=0;var F=false;var G="";var D="";for(E=0;E<A.length;E++){G=A[E][C].split(" ");D=B[C].split(" ");if(C==1||C==2){G=parseInt(G);D=parseInt(D)}if(G>D){F=true;A.insertNth(B,E);break}}if(!F){A[A.length]=B}};__stormcenter.prototype.setColumnHeader=function(C,E){var F="&nbsp";var H="&nbsp";var A=null;var B=null;if(E){F="&uarr"}else{F="&darr"}var G=window.document.getElementById("data_grid_header").rows[0].childNodes;var D=0;for(D=0;D<G.length;D++){B=G[D].childNodes[0];if(B!=null){A=B.innerHTML;if(D==C){A=this.newHeaderString(A,F)}else{A=this.newHeaderString(A,H)}B.innerHTML=A}}};__stormcenter.prototype.newHeaderString=function(A,D){var C=A.split("&nbsp;");var B=C[0].concat("&nbsp;",D,";");return B};__stormcenter.prototype.howToSort=function(A){var B=this.howSorted[A];if(B==null){B=true}else{B=!B}return B};__stormcenter.prototype.addressSearch=function(){var A=window.document.getElementById("address_value").value;if(A!=""){iFactor.common.config.allow_zoom="yes";this.map.Find(null,A,null,null,null,null,null,null,null,null,null)}};__stormcenter.prototype.ensureZoomLevel=function(){var A;var C;var B;A=parseInt(iFactor.common.config.min_zoom_level);C=parseInt(iFactor.common.config.max_zoom_level);B=parseInt(this.map.GetZoomLevel());if(B>A){return A}else{if(B<C){return C}else{return B}}};__stormcenter.prototype.latLngLookup=function(){var C=window.document;var B=parseFloat(C.getElementById("goto_lat").value);var A=parseFloat(C.getElementById("goto_lng").value);if(((B+"")!="NaN")&&((A+"")!="NaN")){this.outsideBoundsMessage="The coordinate is outside the area available to be viewed.";var D=new VELatLong(B,A);this.map.SetCenter(D)}else{window.alert("Please enter valid coordinates.")}};__stormcenter.prototype.showAccountQueryPanel=function(){if(this.accountPanel==null){var A=235;var B=400;var D=null;var C=null;var E=iFactor.common.getInnerWindowDimensions();D=Math.round((E[1]-B)/2.5);C=Math.round((E[0]-A)/1.5);if(D<=10){D=10}A=A+"px";B=B+"px";window.document.getElementById("account").style.display="inline";this.accountPanel=new YAHOO.widget.Panel("account",{close:true,width:A,x:C,y:D,height:B,zIndex:20000,draggable:true})}this.accountPanel.render();this.accountPanel.show()};__stormcenter.prototype.doAccountLookup=function(){var Z=window.document;var K=Z.getElementById("firstname").value;var M=Z.getElementById("lastname").value;var S=Z.getElementById("phonenumber").value;var Q=Z.getElementById("accountnumber").value;if(K==""&&M==""&&S==""&&Q==""){alert("Please enter a value.");return }else{var P=this.getHostRoot()+"/"+iFactor.common.config.servlet_path+"service=account";if(K!=""){P=P+"&firstname="+K}if(M!=""){P=P+"&lastname="+M}if(S!=""){P=P+"&phonenumber="+S}if(Q!=""){P=P+"&accountnumber="+Q}var E=window.document.getElementById("account_results");var O=E.rows;var C=O.length;while(E.rows.length>0){E.deleteRow(0)}var A=E.insertRow(E.rows.length);var D=A.insertCell(A.cells.length);D.innerHTML="Searching for customers.  Please wait...";var F=iFactor.common.createXMLRequest();var B=P+iFactor.common.uniqueRequestTag(false);B=B.fixUrlSeparator();var W=this;F.open("GET",B,false);F.send(null);if((F.readyState==4)&&(F.status!=404)){var N=F.responseXML.getElementsByTagName("account");var R=0;var I=null;var G="";var H=null;var Y=null;var V=null;var L=null;var K=null;var M=null;var S=null;var U=null;var H=null;var Y=null;var E=window.document.getElementById("account_results");var O=E.rows;var C=O.length;for(R=0;R<C;R++){try{E.deleteRow(R)}catch(T){E.deleteRow(-1)}}if(N.length>0){for(R=0;R<N.length;R++){I=N[R];K=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"first_name"));M=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"last_name"));S=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"phone_number"));U=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"area_code"));H=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"lat"));Y=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"lng"));G="Name: "+K+" "+M+"<br/>";G=G+"Phone: "+U+"-"+S;mycurrent_row=E.insertRow(E.rows.length);mycurrent_cell=document.createElement("td");var J=document.createElement("a");J.setAttribute("href","javascript:iFactor.StormCenter.gotoAccount("+H+","+Y+",'"+G+"');");J.className="hlink";var X=document.createElement("b");if(K==null||K=="null"){currenttext=document.createTextNode(M)}else{if(M==null||M=="null"){currenttext=document.createTextNode(K)}else{currenttext=document.createTextNode(M+", "+K)}}X.appendChild(currenttext);J.appendChild(X);mycurrent_cell.appendChild(J);mycurrent_row.appendChild(mycurrent_cell);mycurrent_cell=document.createElement("td");phone=document.createTextNode(U+"-"+S);mycurrent_cell.width="85px";mycurrent_cell.appendChild(phone);mycurrent_row.appendChild(mycurrent_cell)}}else{mycurrent_row=document.createElement("tr");mycurrent_cell=document.createElement("td");currenttext=document.createTextNode("No records found...");mycurrent_cell.appendChild(currenttext);mycurrent_row.appendChild(mycurrent_cell);E.tBodies[0].appendChild(mycurrent_row)}}}};__stormcenter.prototype.gotoAccount=function(E,F,H){var G=this.map;E=parseFloat(E);F=parseFloat(F);var A=new VELatLong(E,F);var J=this.getAccountIdentifier(H);var B=this.getAccountPopup(H,J);var C=new VEPushpin(J,A,null,"Account",B);try{G.AddPushpin(C)}catch(D){}var I=13;G.SetCenterAndZoom(A,I)};__stormcenter.prototype.getAccountIdentifier=function(A){var D="";var C=A.split("<br/>");var B=0;for(B=0;B<C.length;B++){D=D+C[B]}return D};__stormcenter.prototype.getAccountPopup=function(A,E){var H="";var F=A.split("<br/>");var C=0;var B=null;var D=null;var G=H;for(C=0;C<F.length;C++){G=G+F[C];B=F[C].split(": ");D=B.length;if(D==1){H=H+B[0]}else{if(D==2){H=H+"<b>"+B[0]+": </b>"+B[1]}}H=H+"<br/>"}H=H+"Click <a href='javascript:iFactor.StormCenter.map.DeletePushpin(\""+E+"\")'>here</a> to remove this location.";return H};__stormcenter.prototype.togglePointLayer=function(A){var C=this.pointLayers[A];var B=null;B=window.document.getElementById("show"+A);if(B.checked){this.pointLayers[A].Show()}else{this.pointLayers[A].Hide()}this.saveMapState()};__stormcenter.prototype.saveMapState=function(){if(iFactor.common.cookiesEnabled()){var A=new Object();var H=window.document;A.map_type=this.map.GetMapStyle();var G=this.map;var F=G.GetCenter().Latitude;var D=G.GetCenter().Longitude;var C=G.GetZoomLevel();var E=F+","+D+","+C;A.homepage=E;var B="";for(name in A){if(B!=""){B=B+"|"}B=B+name+":"+A[name]}iFactor.common.createCookie("state",B,365)}};__stormcenter.prototype.zoomToOverview=function(){var A=parseFloat(iFactor.common.config.start_lat);var C=parseFloat(iFactor.common.config.start_long);var B=parseInt(iFactor.common.config.start_zoom);var D=new VELatLong(A,C);this.map.SetCenterAndZoom(D,B)};__stormcenter.prototype.setAsHomepage=function(){if(iFactor.common.cookiesEnabled()){var F=this.map;var E=F.GetCenter().Latitude;var B=F.GetCenter().Longitude;var A=F.GetZoomLevel();var D=E+","+B+","+A;iFactor.common.createCookie("homepage",D,365);window.alert("The current view has been set as your homepage.");window.document.getElementById("favoritename").value="Home";var C=window.alert;window.alert=function(){};this.addFavorite();window.alert=C;window.document.getElementById("favoritename").value=""}else{window.alert("Cookies are not enabled.  Cookies must be enabled in order to set the homepage.")}};__stormcenter.prototype.addFavorite=function(){var C=window.document.getElementById("favoritename");var B=C.value;var A=null;var D=this.map;if(this.nameIsValid(B)){A=B+","+D.GetCenter().Latitude+","+D.GetCenter().Longitude+","+D.GetZoomLevel();cookieTxt=this.deriveFavoritesCookieText(B,A);iFactor.common.createCookie("favorites",cookieTxt,365);this.setFavoritesOptions();window.alert("A Favorite named "+B+" has been added.")}};__stormcenter.prototype.getSortedStrings=function(A){var C=new Array();var F=0;var E=0;var B=null;var G=null;var D=null;for(F=0;F<A.length;F++){D=null;B=A[F];if(C.length==0){C[0]=B}else{for(E=0;E<C.length;E++){if(B<C[E]){D=E;break}}if(D==null){C[C.length]=B}else{C.insertNth(B,D)}}}return C};__stormcenter.prototype.deriveFavoritesCookieText=function(B,A){var D=iFactor.common.readCookie("favorites");var F=null;var E=new Array();E[0]=A;var C=0;var G=null;if((D!=null)&&(D!="")){F=D.split("|");for(C=0;C<F.length;C++){G=F[C];if(G.split(",")[0]!=B){E[E.length]=G}}}D="";E=this.getSortedStrings(E);for(C=0;C<E.length;C++){D=D+E[C];if(C!=(E.length-1)){D=D+"|"}}return D};__stormcenter.prototype.nameIsValid=function(E){var F=0;var D=0;var C=this.validCharacters;var A=null;var B=false;var G=true;for(F=0;F<E.length;F++){A=E.charAt(F);B=false;for(D=0;D<C.length;D++){if(A==C.charAt(D)){B=true;break}}if(!B){G=false;break}}return(G&&(E.length>0))};__stormcenter.prototype.setFavoritesOptions=function(){var E=window.document.getElementById("selectedfavorite");if(E!=null){E.innerHTML="";E.options[0]=new Option("Select...","",false);var B=iFactor.common.readCookie("favorites");if(B!=null){var D=B.split("|");var A=0;var C=null;for(A=0;A<D.length;A++){C=D[A].split(",");E.options[E.options.length]=new Option(C[0],C[0],false)}}}};__stormcenter.prototype.gotoFavorite=function(){var I=window.document.getElementById("selectedfavorite");var L=I.options;if(L.length>0){var C=L[I.selectedIndex].value;if(C!=""){var A=iFactor.common.readCookie("favorites");var E=A.split("|");var F=0;var D=null;var J=null;var K=null;var G=null;for(F=0;F<E.length;F++){D=E[F].split(",");if(D[0]==C){J=parseFloat(D[1]);K=parseFloat(D[2]);G=new VELatLong(J,K);var B=parseInt(iFactor.common.config.min_zoom_level);var H=parseInt(D[3]);if(H>B){H=B}this.map.SetCenterAndZoom(G,H);break}}}}};__stormcenter.prototype.showAlerts=function(){var B=iFactor.common.createXMLRequest();var A=iFactor.common.config.data_static_directory+"/"+iFactor.common.config.alert_file;A=A+iFactor.common.uniqueRequestTag(true);A=A.fixUrlSeparator();B.onreadystatechange=function(){iFactor.StormCenter.doShowAlerts(B)};B.open("GET",A,true);B.send(null)};__stormcenter.prototype.doShowAlerts=function(D){if((D.readyState==4)&&(D.status!=404)){var A=D.responseXML.getElementsByTagName("alert");var B=window.document.getElementById("alertstable");iFactor.common.clearTable(B);var F=A.length;var E=0;var H=null;var I=null;var J=null;var G=null;var K=null;var C=null;if(F==0){H=B.insertRow(B.rows.length);I=H.insertCell(0);I.className="VE_Pushpin_Popup_Body";I.innerHTML="No alerts."}else{for(E=0;E<F;E++){J=A.item(E);G=iFactor.common.getXMLChildNamed(J,"heading");K=iFactor.common.getXMLChildNamed(J,"date");C=iFactor.common.getXMLChildNamed(J,"text");H=B.insertRow(B.rows.length);I=H.insertCell(0);I.className="alerttitle";I.innerHTML=iFactor.common.getXMLNodeValue(G);H=B.insertRow(B.rows.length);I=H.insertCell(0);I.className="alertdate";I.innerHTML=iFactor.common.getXMLNodeValue(K);H=B.insertRow(B.rows.length);I=H.insertCell(0);I.className="alertbody";I.innerHTML=iFactor.common.getXMLNodeValue(C);H=B.insertRow(B.rows.length);I=H.insertCell(0);I.className="alertbody";I.innerHTML="&nbsp;"}}}};__stormcenter.prototype.gotoArea=function(){var B=window.document.getElementById("areaselect").value;if(B!="none"){var A=B+", United States";this.map.Find(null,A,null,null,null,null,null,null,null,null,null);this.saveMapState()}};__stormcenter.prototype.showProviderChartPanel=function(){var A="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0' width='560px' height='585px' id='wholesalechart'>";A=A+"<param name='movie' value='flashcharts/FC_2_3_Column2D.swf'/>";A=A+"<param name='FlashVars' value='&dataURL=datastatic/providerchart.xml&chartWidth=560&chartHeight=585'/>";A=A+"<param name='quality' value='high'/>";A=A+"<param name='bgcolor' value='#FFFFFF'/>";A=A+"<embed src='flashcharts/FC_2_3_Column2D.swf' flashvars='&dataURL=datastatic/providerchart.xml' quality='high' bgcolor='#FFFFFF' width='560px' height='585px' name='wholesalechart' type='application/x-shockwave-flash' pluginspace='http://www.macromedia.com/go/getflashplayer'></embed>";A=A+"</object>";if(this.providerChartPanel==null){this.providerChartPanel=this.getNewChart("providerchart")}this.providerChartPanel.setBody(A);this.providerChartPanel.render();this.providerChartPanel.show()};__stormcenter.prototype.getHostRoot=function(){var E=window.location.href;var C=0;var D="";var B=0;var A=null;for(B=0;B<E.length;B++){A=E.charAt(B);if(A=="/"){C=C+1}if(C==3){break}D=D+A}return D};iFactor.StormCenter=new __stormcenter();