__stormcenter=function(){this.fullDayNames=["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"];this.numOutages=null;this.numCustomersAffected=null;this.basicmenu=null;this.oMenu=null;this.alertPanel=null;this.drillDownPanel=null;this.helpPanel=null;this.overlayManager=null;this.isPageLoaded=null};__stormcenter.prototype.loadStormCenter=function(){this.reloadLayers=new Object();this.lastDateGenerated=null;var F=iFactor.common.getArguments()["accountnumber"];this.outsideBoundsMessage=null;this.howSorted=new Array();this.checkBrowserCompatibility();this.readConfigFromCookies();this.ensureControlStates();var I=iFactor.common.getArguments()["x"];var H=iFactor.common.getArguments()["y"];var E=parseInt(iFactor.common.config.opacity)/100;this.current_outage_indices=new Array();this.current_outage_level=0;this.simpleAreasRendered=new Array();if(document.getElementById("map").style.height&&document.getElementById("map").style.height=="auto"){this.setMapDivSize()}this.lastZoom=new Array(null,null);this.validCharacters="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789 ,";this.timerId=null;this.setFavoritesOptions();this.radioLayerNames=[];this.toggleLayerNames=[];this.pointLayerNames=new Object();this.pointLayerNames=["outages","thematic","serviceareas"];this.pointLayers=new Object();this.layersDefinition=new Object();this.tileLayerNames=new Array();for(i=0;i<iFactor.common.configLayers.length;i++){var G=iFactor.common.configLayers[i];if(G.type=="tilelayer"){this.tileLayerNames[i]=G.layer_name;this.layersDefinition[G.layer_name]=G}}this.tileLayers=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(D){alert("The map is currently unavailable. Please wait a few moments and refresh your browser window.");return }var A=this.getStartLatLngZoom();var B=new VELatLong(A[0],A[1]);if(this.map.EnableShapeDisplayThreshold){this.map.EnableShapeDisplayThreshold(false)}this.map.SetDashboardSize(VEDashboardSize.Normal);var J=new VEMapOptions();J.EnableBirdseye=false;this.map.LoadMap(B,A[2],iFactor.common.config.map_type,null,null,false,null,J);this.loadTileLayers();this.map.AttachEvent("onchangeview",function(){iFactor.StormCenter.onMapPan()});this.map.AttachEvent("onchangemapstyle",function(){iFactor.StormCenter.saveMapState()});this.map.AttachEvent("onmouseover",function(K){iFactor.StormCenter.mouseShapeHandler(K)});this.map.AttachEvent("onmouseout",function(K){iFactor.StormCenter.mouseShapeHandler(K)});this.map.AttachEvent("ontokenexpire",function(K){iFactor.StormCenter.handleTokenExpire(K)});this.map.AttachEvent("ontokenerror",function(K){iFactor.StormCenter.handleTokenError(K)});this.providerChartPanel=null;if((I!=null)&&(I!="")&&(H!=null)&&(H!="")){this.zoomToXY(I,H)}else{if((F!=null)&&(F!="")){this.gotoSpecifiedAccountNumber(F)}else{this.onMapPan()}}this.setupOverlayManager();document.getElementById("MSVE_navAction_topBar").removeChild(document.getElementById("MSVE_navAction_showLabels"));document.getElementById("MSVE_navAction_topBar").removeChild(document.getElementById("MSVE_navAction_separator2"));document.getElementById("MSVE_navAction_topBar").removeChild(document.getElementById("MSVE_navAction_separator3"))};__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(){for(i=0;i<this.tileLayerNames.length;i++){var A=this.tileLayerNames[i];this.addTileLayer(A)}};__stormcenter.prototype.addTileLayer=function(A){var C=this.getSourceTilesDirectory(A);if(C!=null){var D=this.getTileDefaultDisplay(A);var B=new VETileSourceSpecification(A,C+"/%4.png");this.setTileSourceSpecification(A,B);this.tileLayers[A]=B;this.map.AddTileLayer(B);this.showHideTileLayerSafely(A,D);this.toggleIfNecessary("show"+A,D.toString())}};__stormcenter.prototype.getSourceTilesDirectory=function(D){var F=this.layersDefinition[D].data_directory;var G=F;var E=iFactor.common.createXMLRequest();var A=G+"/metadata.xml";A=A+iFactor.common.uniqueRequestTag(true);E.open("GET",A,false);E.send(null);if((E.readyState==4)&&(E.status!=404)&&(E.status!=403)){var C=E.responseXML.getElementsByTagName("directory")[0];var B=iFactor.common.getXMLNodeValue(C);return G+"/"+B}return null};__stormcenter.prototype.setTileSourceSpecification=function(B,H){var A=this.layersDefinition[B].min_zoom;if(A==""){A=iFactor.common.config.max_zoom_level}var G=this.layersDefinition[B].max_zoom;if(G==""){G=iFactor.common.config.min_zoom_level}var F=parseInt(A);var C=parseInt(G);var D=this.layersDefinition[B].opacity;var I=parseInt(this.layersDefinition[B].zindex);H.MaxZoomLevel=C;H.MinZoomLevel=F;H.ZIndex=I;if(D!=""){var E=null;if(/MSIE (\d+\.\d+);/.test(navigator.userAgent)){E=new Number(RegExp.$1)}if(E!=6){H.Opacity=parseFloat(D)}}};__stormcenter.prototype.getTileDefaultDisplay=function(A){var B=this.layersDefinition[A].default_display;if(B=="on"){return true}else{if(B=="off"){return false}else{return true}}};__stormcenter.prototype.getOpacity=function(){return(this.slider.getValue()/100)};__stormcenter.prototype.toggleTileLayer=function(A,B){if(A){this.map.ShowTileLayer(B)}else{this.map.HideTileLayer(B)}this.saveMapState()};__stormcenter.prototype.setRadioLayer=function(C){var E=0;var D=null;if(C=="areas"){this.showHidePointLayerSafely("thematic","true");this.showHidePointLayerSafely("outages","false");var B=window.document.getElementById("showthematic");var F=this.map.GetZoomLevel();var A=parseInt(iFactor.common.config.service_area_border_min_zoom);var G=parseInt(iFactor.common.config.service_area_border_max_zoom);if((F>=A)&&(F<=G)){this.showHidePointLayerSafely("serviceareas","true")}}else{if(C=="locations"){this.showHidePointLayerSafely("thematic","false");this.showHidePointLayerSafely("outages","true");this.showHidePointLayerSafely("serviceareas","false")}}this.updateLegend();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(){var D=iFactor.common.createXMLRequest();var C=iFactor.common.config.data_directory+"/data.xml";C=C+iFactor.common.uniqueRequestTag(true);C=C.fixUrlSeparator();D.open("GET",C,false);D.send(null);if((D.readyState==4)&&(D.status!=404)&&(D.status!=403)){var F=D.responseXML;var B=F.getElementsByTagName("storm_mode").item(0);var H=iFactor.common.getXMLNodeValue(B);if(H!=null&&H=="y"){this.toggleIfNecessary("showthematic","true");this.toggleIfNecessary("showoutages","false")}else{this.toggleIfNecessary("showthematic","false");this.toggleIfNecessary("showoutages","true")}}this.toggleIfNecessary("showserviceareas","true");var A=["favoritename","address_value"];var E=0;var I=window.document;var G=null;for(E=0;E<A.length;E++){if(I.getElementById(A[E])!=null){I.getElementById(A[E]).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.verifyCheckbox=function(C){var B=window.document.getElementById(C);if(B!=null){var A=B.checked;return A}return true};__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-22;var B=myWidth-247;var C=B-193;if((document.getElementById)&&(!document.all)){A=A+"px";B=B+"px";C=C+"px"}window.document.getElementById("map").style.height=A;window.document.getElementById("map").style.width=B;window.document.getElementById("alertheader").style.width=C};__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-22;var B=myWidth-247;var C=B-193;if((document.getElementById)&&(!document.all)){A=A+"px";B=B-5+"px";C=C-5+"px";window.document.getElementById("map").style.height=A;window.document.getElementById("map").style.width=B;window.document.getElementById("alertheader").style.width=C}else{this.map.Resize(B,A);window.document.getElementById("map").style.height=A;window.document.getElementById("map").style.width=B;window.document.getElementById("alertheader").style.width=C}};__stormcenter.prototype.tabshow=function(D){var F=document.getElementById(D+"_tab");var H=document.getElementById(D+"_content");if(D=="legend"){document.getElementById("legend_radio").style.display="block";if(window.document.getElementById("showthematic").checked){H=document.getElementById("thematic_content")}}else{if(D=="summary"||D=="learn"){document.getElementById("legend_radio").style.display="none"}}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="block";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.updateAlertsHeader();this.updatePointLayers();this.controlLayerVisibility();this.startTimer()}else{this.returnToLastBounds()}this.saveMapState();this.outsideBoundsMessage=null};__stormcenter.prototype.controlLayerVisibility=function(){var I=iFactor.common.config.thematic_default_display;var G=parseInt(iFactor.common.config.thematic_threshold);var L=parseInt(iFactor.common.config.thematic_min_zoom);var C=parseInt(iFactor.common.config.thematic_max_zoom);var J=parseInt(iFactor.common.config.service_area_border_min_zoom);var A=parseInt(iFactor.common.config.service_area_border_max_zoom);var H=window.document;var D=H.getElementById("num_outages_text").innerHTML;var F=parseInt(D.split(" ")[2]);var K=this.map.GetZoomLevel();var E=(K>=L)&&(K<=C);if(this.isPageLoaded==null){if(E&&(I=="on"||(F>=G&&I=="auto"))){this.toggleIfNecessary("showthematic","true");this.toggleIfNecessary("showserviceareas","true");this.toggleIfNecessary("showoutages","false");this.showHidePointLayerSafely("thematic","true");this.showHidePointLayerSafely("serviceareas","true");this.showHidePointLayerSafely("outages","false")}else{this.toggleIfNecessary("showthematic","false");this.toggleIfNecessary("showserviceareas","false");this.toggleIfNecessary("showoutages","true");this.showHidePointLayerSafely("thematic","false");this.showHidePointLayerSafely("serviceareas","false");this.showHidePointLayerSafely("outages","true")}}this.isPageLoaded=true;var B=window.document.getElementById("showthematic");if(K>C){B.disabled=true}else{B.disabled=false}this.updateLegend();if(B.checked==true&&((K>=J)&&(K<=A))){this.toggleIfNecessary("showserviceareas","true");this.showHidePointLayerSafely("serviceareas","true")}else{this.toggleIfNecessary("showserviceareas","false");this.showHidePointLayerSafely("serviceareas","false")}};__stormcenter.prototype.updateLegend=function(){var A=document.getElementById("legend_tab");if(A.className=="on"){this.tabshow("legend")}};__stormcenter.prototype.showHidePointLayerSafely=function(A,B){if(this.pointLayers[A]!=null){if(B=="true"){this.pointLayers[A].Show()}else{this.pointLayers[A].Hide()}}};__stormcenter.prototype.showHideTileLayerSafely=function(A,B){if(this.tileLayers[A]!=null){this.toggleTileLayer(B,A)}};__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=="serviceareas"){this.readStaticPointLayer(A)}if(this.numOutages!=null&&this.numOutages>0){if(A=="outages"){this.removeLayerIfNeedToBeReload(A);this.readPointLayer(A)}else{if(A=="thematic"){this.removeLayerIfNeedToBeReload(A);this.readSimplePointLayer(A)}}}else{if(A!="serviceareas"){var C=this.pointLayers[A];if(C!=null){C.DeleteAllShapes()}}}}};__stormcenter.prototype.removeLayerIfNeedToBeReload=function(A){var C=this.pointLayers[A];var B=this.reloadLayers[A];if(C!=null&&B==true){if(A=="thematic"){C.DeleteAllShapes();this.simpleAreasRendered[A]=false}if(A=="outages"){this.zoomLevelPointLayers=new Array()}this.reloadLayers[A]=false}};__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)&&(C.status!=403)){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||!this.simpleAreasRendered[I]){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)&&(C.status!=403)){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){C=C+iFactor.common.uniqueRequestTag(true);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)&&(B.status!=403)){var F=D;var E=this.pointLayers[F];if(E==null){E=new VEShapeLayer();this.pointLayers[F]=E}if(!A){E.Hide()}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.gotoAreaLatLngPHI=function(){var D=window.document.getElementById("areaselect").value.split(",");var C=new VELatLong(D[0],D[1]);var A=12;var B=parseInt(iFactor.common.config.min_zoom_level);if(A>B){A=B}this.map.SetCenterAndZoom(C,A)};__stormcenter.prototype.gotoAreaLatLngWe=function(E,D,C,B){document.getElementById("menuLabel").innerHTML=B;document.getElementById("latLongHidden").value=E+","+D+","+C;var F=window.document.getElementById("areaselect");var H=new VELatLong(E,D);var A=parseInt(C);var G=parseInt(iFactor.common.config.min_zoom_level);if(A>G){A=G}this.map.SetCenterAndZoom(H,A)};__stormcenter.prototype.gotoAreaLatLng=function(){var D=window.document.getElementById("latLongHidden").value.split(",");var C=new VELatLong(D[0],D[1]);var A=parseInt(D[2]);var B=parseInt(iFactor.common.config.min_zoom_level);if(A>B){A=B}this.map.SetCenterAndZoom(C,A)};__stormcenter.prototype.gotoCommunityLatLng=function(){var D=window.document.getElementById("goto_community_input").value.split(",");var C=new VELatLong(D[0],D[1]);var A=parseInt(D[2]);var B=parseInt(iFactor.common.config.min_zoom_level);if(A>B){A=B}this.map.SetCenterAndZoom(C,A)};__stormcenter.prototype.gotoStateLatLng=function(){var C=window.document.getElementById("stateselect");var B=C.options[C.selectedIndex].text;var F=window.document.getElementById("stateselect").value.split(",");var E=new VELatLong(F[0],F[1]);var A=parseInt(F[2]);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);this.toggleIfNecessary("showthematic","false");this.toggleIfNecessary("showserviceareas","false");this.toggleIfNecessary("showoutages","true");this.showHidePointLayerSafely("thematic","false");this.showHidePointLayerSafely("serviceareas","false");this.showHidePointLayerSafely("outages","true")};__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;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(0,0));H[1]=this.map.PixelToLatLong(new VEPixel(0,2*F.y));H[2]=this.map.PixelToLatLong(new VEPixel(2*F.x,0));H[3]=this.map.PixelToLatLong(new VEPixel(2*F.x,2*F.y));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 F=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)&&(E.status!=403)){var C=E.responseXML;var B=C.getElementsByTagName("total_outages").item(0);this.numOutages=iFactor.common.getXMLNodeValue(B);F.getElementById("num_outages_text").innerHTML="<b>Active Outages:</b> "+this.numOutages;B=C.getElementsByTagName("total_customers").item(0);this.numCustomersAffected=iFactor.common.getXMLNodeValue(B);F.getElementById("num_custs_text").innerHTML="<b>Affected Customers:</b> "+this.numCustomersAffected;var D=iFactor.common.getXMLNodeValue(C.getElementsByTagName("date_generated").item(0));if(D!=this.lastDateGenerated){this.lastDateGenerated=D;this.reloadLayers.outages=true;this.reloadLayers.thematic=true}}};__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.zoomToXY=function(A,B){minZoom=iFactor.common.config.min_zoom_level;this.map.SetCenterAndZoom(new VELatLong(A,B),minZoom)};__stormcenter.prototype.zoomToForeignXY=function(J,I){var F=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)&&(D.status!=403)){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(){window.document.getElementById("helppanel").style.display="block";this.overlayManager.bringToTop("helppanel")};__stormcenter.prototype.showAlertPanel=function(){window.document.getElementById("alertpanel").style.display="block";this.overlayManager.bringToTop("alertpanel")};__stormcenter.prototype.showDrillDownPanel=function(){window.document.getElementById("drilldowncontent").innerHTML='<iframe src ="drilldown.html" width="810px" height="320px" marginheight=0px marginwidth=0px frameborder=0 scrolling=no></iframe>';window.document.getElementById("drilldownpanel").style.display="block";this.overlayManager.bringToTop("drilldownpanel")};__stormcenter.prototype.showCustomerTablePanel=function(){if(this.customerTablePanel==null){window.document.getElementById("customertable").style.display="block";var E=iFactor.common.getInnerWindowDimensions();var A=395;var B=385;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.customerTablePanel=new YAHOO.widget.Panel("customertable",{width:A,height:B,x:C,y:D,close:true,draggable:true,zIndex:2000,constraintoviewport:true})}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)&&(B.status!=403)){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,"112px");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,I)};__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,D,I){var G="&nbsp";var B="&nbsp";var E=null;var A=null;if(D){G="&uarr"}else{G="&darr"}var H=window.document.getElementById(I+"_header").rows[0].childNodes;var F=0;for(F=0;F<H.length;F++){A=H[F].childNodes[0];if(A!=null){E=A.innerHTML;if(F==C){E=this.newHeaderString(E,G)}else{E=this.newHeaderString(E,B)}A.innerHTML=E}}};__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="block";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 a=window.document;var K=a.getElementById("firstname").value;var M=a.getElementById("lastname").value;var T=a.getElementById("phonenumber").value;var R=a.getElementById("accountnumber").value;if(K==""&&M==""&&T==""&&R==""){alert("Please enter a value.");return }else{var Q=iFactor.common.config.servlet_path+"service=account";if(K!=""){Q=Q+"&firstname="+K}if(M!=""){Q=Q+"&lastname="+M}if(T!=""){Q=Q+"&phonenumber="+T}if(R!=""){Q=Q+"&accountnumber="+R}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=Q+iFactor.common.uniqueRequestTag(false);B=B.fixUrlSeparator();var X=this;F.open("GET",B,false);F.send(null);if((F.readyState==4)&&(F.status!=404)&&(F.status!=403)){var N=F.responseXML.getElementsByTagName("account");var S=0;var I=null;var G="";var H=null;var Z=null;var W=null;var L=null;var K=null;var M=null;var P=null;var T=null;var V=null;var H=null;var Z=null;var E=window.document.getElementById("account_results");E.style.tableLayout="fixed";var O=E.rows;var C=O.length;for(S=0;S<C;S++){try{E.deleteRow(S)}catch(U){E.deleteRow(-1)}}if(N.length>0){for(S=0;S<N.length;S++){I=N[S];K=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"first_name"));M=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"last_name"));T=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"phone_number"));P=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"location_desc"));V=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"area_code"));H=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"lat"));Z=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(I,"lng"));G="Name: "+K+" "+M+"<br/>";G=G+"Phone: "+V+"-"+T;mycurrent_row=E.insertRow(E.rows.length);mycurrent_cell=document.createElement("td");mycurrent_cell.width="140px";var J=document.createElement("a");J.setAttribute("href","javascript:iFactor.StormCenter.gotoAccount("+H+","+Z+",'"+G+"');");J.className="hlink";var Y=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)}}Y.appendChild(currenttext);J.appendChild(Y);mycurrent_cell.appendChild(J);mycurrent_row.appendChild(mycurrent_cell);mycurrent_cell=document.createElement("td");mycurrent_cell.width="85px";if(V!="0"&&T!=null){phone=document.createTextNode(V+"-"+T)}else{phone=document.createTextNode("Unknown")}mycurrent_cell.style.paddingRight="3";mycurrent_cell.style.whiteSpace="nowrap";mycurrent_cell.appendChild(phone);mycurrent_row.appendChild(mycurrent_cell);mycurrent_cell=document.createElement("td");mycurrent_cell.width="180px";phone=document.createTextNode(P);mycurrent_cell.style.whiteSpace="nowrap";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+"<br>Click <a href='javascript:iFactor.StormCenter.map.DeletePushpin(\""+E+"\")'>here</a> to remove this location.";return H};__stormcenter.prototype.gotoAccountNumber=function(){var A=window.document.getElementById("accountinput").value;this.gotoSpecifiedAccountNumber(A)};__stormcenter.prototype.gotoSpecifiedAccountNumber=function(H){if(H!=""){var K=null;var M=null;var J=iFactor.common.config.servlet_path+"service=account";J=J+"&accountnumber="+H;var F=iFactor.common.createXMLRequest();var E=J+iFactor.common.uniqueRequestTag(false);E=E.fixUrlSeparator();var L=this;F.open("GET",E,false);F.send(null);if((F.readyState==4)&&(F.status!=404)&&(F.status!=403)){var C=F.responseXML.getElementsByTagName("account");var G=0;var D=null;var B=null;var A=null;var I=null;if(C.length>0){D=C[0];B=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(D,"account_number"));A=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(D,"account_name"));I=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(D,"address"));K=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(D,"lat"));M=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(D,"lng"))}}if(K!=null&&M!=null){this.map.DeleteAllPushpins();this.gotoAccountLatLong(K,M,H)}else{alert("There is not an account number as "+H)}}};__stormcenter.prototype.gotoAccountLatLong=function(F,G,D){var H=this.map;F=parseFloat(F);G=parseFloat(G);var A=new VELatLong(F,G);var J="Account:"+D;var B=this.getAccountPopupLatLong(D,J);var C=new VEPushpin(J,A,null,"Account Number",B);try{H.AddPushpin(C)}catch(E){}var I=13;H.SetCenterAndZoom(A,I)};__stormcenter.prototype.getAccountPopupLatLong=function(B,A){var C="";var C="<br><b>Account Number: </b>"+B+"</br>";C=C+"<br></br><br>Click <a href='javascript:iFactor.StormCenter.map.DeletePushpin(\""+A+"\")'>here</a> to remove this location.";return C};__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");E.innerText="";if(E!=null){E.innerHTML="";E.options[0]=new Option("Select...","",false);var B=iFactor.common.readCookie("favorites");if(B!=null&&B!=""){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.gotoFavoriteDel=function(){var G=window.document.getElementById("selectedfavorite");var I=G.options;var H=null;var A=null;if(I.length>0){var B=I[G.selectedIndex].value;if(B!=""){A=iFactor.common.readCookie("favorites");var E=A.split("|");var F=0;var D=0;var C=null;H=new Array(E.length);for(k=0;k<E.length;k++){H[k]=E[k]}for(F=0;F<H.length;F++){C=H[F].split(",");if(C[0]==B){H[F]=null;for(D=F;D<H.length-1;D++){H[D]=H[D+1]}}}H.length=H.length-1}}if(H!=null){A="";for(F=0;F<H.length;F++){if(H[F]!=null){A=A+H[F];if(F!=(H.length-1)){A=A+"|"}}}}else{A=""}iFactor.common.createCookie("favorites",A,365);this.setFavoritesOptions()};__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.updateAlertsHeader=function(){var B=iFactor.common.createXMLRequest();var A=iFactor.common.config.alert_file;A=A+iFactor.common.uniqueRequestTag(true);A=A.fixUrlSeparator();B.onreadystatechange=function(){iFactor.StormCenter.doShowAlertsHeader(B)};B.open("GET",A,true);B.send(null)};__stormcenter.prototype.doShowAlertsHeader=function(D){if((D.readyState==4)&&(D.status!=404)&&(D.status!=403)){var A,C;var G,B,F;var E=D.responseXML.getElementsByTagName("alert");if(E.length>0){for(i=0;i<E.length;i++){A=E[i];G=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(A,"title"));B=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(A,"short_text"));F=iFactor.common.getXMLNodeValue(iFactor.common.getXMLChildNamed(A,"long_text"))}if((G==null||G=="")&&(F!=null&&F!="")){G="Click Here for Alerts"}if(G!=null&&(G!=""||F!="")){C=F;document.getElementById("alertcontent").innerHTML=C;document.getElementById("alertheaderline1").innerHTML=G;document.getElementById("alertheader").style.display=""}}}};__stormcenter.prototype.highlightAlerts=function(){document.getElementById("alertheader").style.opacity="0.7";if(document.all){document.getElementById("alertheader").style.filter="alpha(opacity=70)"}};__stormcenter.prototype.unHighlightAlerts=function(){document.getElementById("alertheader").style.opacity="0.4";if(document.all){document.getElementById("alertheader").style.filter="alpha(opacity=40)"}};__stormcenter.prototype.showAlertsTab=function(){var B=iFactor.common.createXMLRequest();var A=iFactor.common.config.alert_file;A=A+iFactor.common.uniqueRequestTag(true);A=A.fixUrlSeparator();B.onreadystatechange=function(){iFactor.StormCenter.doShowAlertsTab(B)};B.open("GET",A,true);B.send(null)};__stormcenter.prototype.doShowAlertsTab=function(D){if((D.readyState==4)&&(D.status!=404)&&(D.status!=403)){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;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};__stormcenter.prototype.setupAreaDropDownMenu=function(){if(this.oMenu==null){this.oMenu=new YAHOO.widget.MenuBar("basicmenu",{autosubmenudisplay:true,hidedelay:750,submenualignment:["tr","br"],autosubmenudisplay:false,lazyload:true})}this.oMenu.render();this.oMenu.show()};__stormcenter.prototype.checkEnter=function(C,B){var A;if(C&&C.which){C=C;A=C.which}else{C=event;A=C.keyCode}if(A==13){if(B=="address_value"){iFactor.StormCenter.addressSearch();return false}else{if(B=="communityinput"){iFactor.StormCenter.gotoCommunityLatLng();return false}}}else{return true}};__stormcenter.prototype.keyIsEnter=function(C,B){var A;if(C&&C.which){C=C;A=C.which}else{C=event;A=C.keyCode}if(A==13){return true}else{return false}};__stormcenter.prototype.setupOverlayManager=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}}myWidth=Math.round(myWidth*0.5);myHeight=Math.round(myHeight*0.5);this.helpPanel=new YAHOO.widget.Panel("helppanel",{width:"600px",x:Math.round(myWidth-200),y:Math.round(myHeight-(myHeight/2)),close:true,visible:false,constraintoviewport:true,draggable:true});this.helpPanel.render();this.alertPanel=new YAHOO.widget.Panel("alertpanel",{width:"600px",close:true,fixedcenter:true,visible:false,draggable:true,constraintoviewport:true,zIndex:2000});this.alertPanel.render();this.drillDownPanel=new YAHOO.widget.Panel("drilldownpanel",{width:"860px",close:true,x:Math.round(myWidth-300),y:Math.round(myHeight-(myHeight/2)),constraintoviewport:true,visible:false,draggable:true});this.drillDownPanel.render();this.overlayManager=new YAHOO.widget.OverlayManager();this.overlayManager.register([this.alertPanel,this.drillDownPanel,this.helpPanel]);YAHOO.util.Event.addListener("header_links","click",this.helpPanel.show,this.helpPanel,true);YAHOO.util.Event.addListener("alertheader","click",this.alertPanel.show,this.alertPanel,true);YAHOO.util.Event.addListener("drillPanel","click",this.drillDownPanel.show,this.drillDownPanel,true)};iFactor.StormCenter=new __stormcenter();