__stormcenter.prototype.handleSOAPException=function(C){var B=C.description;var A=C.message;if(B&&B.match("IFTokenExpired")){iFactor.StormCenter.showAlertBox("Your session has expired.  Please refresh your browser.")}else{if(B&&B.match("IFCannotRemoveSoleAdminUser")){iFactor.StormCenter.showAlertBox("You are attempting to remove the sole Administrator for this organization.  That is not allowed.  First assign another user Admin permissions and then try your action again.")}else{if(B&&B.match("IFInsufficientRights")){iFactor.StormCenter.showAlertBox("You do not have sufficient rights for this action.")}else{if(B&&B.match("IFInvalidCredentials")){iFactor.StormCenter.showAlertBox("Username/password incorrect.")}else{if(B&&B.match("IFNoSuchRecordException")){iFactor.StormCenter.showAlertBox("No such record is found.")}else{if(B&&B.match("IFInvalidEmailAddress")){iFactor.StormCenter.showAlertBox("The Email Address is not in a valid format.")}else{if(B&&B.match("IFIncidentNotReported")){var D=B.split("</>");if(D.length>0){iFactor.StormCenter.showAlertBox(D[1])}else{iFactor.StormCenter.showAlertBox("There was a problem completing your report. <br><br> We have been notified about this issue and will look into the problem shortly, but please feel free to try again.")}}else{if(B&&B.match("</>")){var D=B.split("</>");if(D.length>0){iFactor.StormCenter.showAlertBox(D[1])}else{iFactor.StormCenter.showAlertBox("There was a problem completing your report. <br><br> We have been notified about this issue and will look into the problem shortly, but please feel free to try again.")}}else{if(A&&A.match("Result-Status:0")){}else{proxies.alertException(C)}}}}}}}}}};__stormcenter.prototype.loadStormCenterMap=function(){var F;var G;this.doc=window.document;try{if(window.document.getElementById("token")){var B=window.document.getElementById("token").innerHTML}F=this.map=new VEMap("map");if(window.document.getElementById("map1")){G=this.map1=new VEMap("map1")}if(B!=null&&B!=""){this.map.SetClientToken(B);if(window.document.getElementById("map1")){this.map1.SetClientToken(B)}}}catch(E){return }var C=this.getStartLatLngZoom();var D=new VELatLong(C[0],C[1]);if(this.map.EnableShapeDisplayThreshold){this.map.EnableShapeDisplayThreshold(false)}this.map.SetDashboardSize(VEDashboardSize.Normal);var A=new VEMapOptions();A.EnableBirdseye=true;if(iFactor.common.config.map_type!=null||iFactor.common.config.map_type!=""){this.map.LoadMap(D,C[2],iFactor.common.config.map_type,0,VEMapMode.Mode2D,false,A)}else{this.map.LoadMap(D,C[2],"r",null,null,false,null,A)}this.map.AttachEvent("onchangeview",function(H){iFactor.StormCenter.onMapPan()})};__stormcenter.prototype.loadSteetlightConfiguration=function(){var A=this;tabView=new YAHOO.widget.TabView("content",{activeIndex:0});A.loadYUIButtons();A.loadMainConfiguration();A.createZoomOption();A.loadDisplayConfiguration("load");A.loadIntegration()};__stormcenter.prototype.loadMainConfiguration=function(){this.iFactorGetOrganizationInfoForUserToken();var C=function(D){document.mainForm.domaintxt.value=D};var A=config.iFactorUserToken;var B={prepare:function(D){return D},call:function(E){var D=proxies.IFCommonService.GetDomains;D.func=this.call.func;D.onException=this.call.onException;D(A)},finish:C,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.iFactorPopulateOrgTrustList=function(){var D=this;var E=iFactor.common.orgName;var B=iFactor.common.fullOrgName;var A="Organizations that "+E+" ("+B+") trusts to view "+E+"&#039;s assets and incidents:";var C="Organizations that  trust "+E+" ("+B+") to view their assets and incidents :";document.getElementById("curOrgTustView").innerHTML=A;document.getElementById("otherOrgTrustView").innerHTML=C;D.iFactorGetTrustedOrganizationNames();D.iFactorGetTrustingOrganizationNames()};__stormcenter.prototype.iFactorGetTrustingOrganizationNames=function(){var C=this;this.hideTrustTable("otherOrg");var D=function(J){var G=window.document.getElementById("otherOrgTrustViewTable");var N=window.document.getElementById("otherOrgTrustViewBody");var O=G.rows;var F=O.length;var H;for(H=0;H<F;H++){try{G.deleteRow(H)}catch(I){G.deleteRow(-1)}}if(J!=null&&J!=""){var E=null;var M=null;var K=null;for(H=0;H<J.length;H++){mycurrent_row=G.insertRow(G.rows.length);mycurrent_cell=document.createElement("td");mycurrent_cell.style.width="180px";E=document.createTextNode(J[H]);mycurrent_cell.appendChild(E);mycurrent_row.appendChild(mycurrent_cell);mycurrent_cell=document.createElement("td");mycurrent_cell.style.width="100px";var K=document.createElement("a");K.setAttribute("href","javascript:iFactor.StormCenter.iFactorBreakTrustRelationship('trustingOrgName','"+J[H].replace(/^\s+|\s+$/g,"")+"');");K.className="hlinkAccount";var L=document.createElement("img");L.src="images/closebutton.jpg";K.appendChild(L);mycurrent_cell.appendChild(K);mycurrent_row.appendChild(mycurrent_cell);N.appendChild(mycurrent_row)}}mycurrent_row=G.insertRow(G.rows.length);mycurrent_cell=document.createElement("td");mycurrent_cell.style.width="180px";M=document.createTextNode("Register a Trust Token");mycurrent_cell.appendChild(M);mycurrent_row.appendChild(mycurrent_cell);mycurrent_cell=document.createElement("td");mycurrent_cell.style.width="100px";var K=document.createElement("a");K.setAttribute("href","javascript:iFactor.StormCenter.showTrustTable('otherOrg');");K.className="hlinkAccount";var L=document.createElement("img");L.src="images/addbutton.JPG";K.appendChild(L);mycurrent_cell.appendChild(K);mycurrent_row.appendChild(mycurrent_cell);N.appendChild(mycurrent_row)};var A=this.GetIFactorUserToken();var B={prepare:function(E){return E},call:function(F){var E=proxies.IFCommonService.GetTrustingOrganizationNames;E.func=this.call.func;E.onException=this.call.onException;E(A)},finish:D,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.iFactorGetTrustedOrganizationNames=function(){var C=this;var D=function(G){var E=null;var M=null;var K=null;var H=window.document.getElementById("curOrgTrustViewTable");var N=window.document.getElementById("curOrgTrustViewBody");var O=H.rows;var F=O.length;for(I=0;I<F;I++){try{H.deleteRow(I)}catch(J){H.deleteRow(-1)}}if(G!=""||G!=null){for(var I=0;I<G.length;I++){mycurrent_row=H.insertRow(H.rows.length);mycurrent_cell=document.createElement("td");mycurrent_cell.style.width="180px";E=document.createTextNode(G[I]);mycurrent_cell.appendChild(E);mycurrent_row.appendChild(mycurrent_cell);mycurrent_cell=document.createElement("td");mycurrent_cell.style.width="100px";var K=document.createElement("a");K.setAttribute("href","javascript:iFactor.StormCenter.iFactorBreakTrustRelationship('trustedOrgName','"+G[I]+"');");K.className="hlinkAccount";var L=document.createElement("img");L.src="images/closebutton.jpg";K.appendChild(L);mycurrent_cell.appendChild(K);mycurrent_row.appendChild(mycurrent_cell);N.appendChild(mycurrent_row)}}mycurrent_row=H.insertRow(H.rows.length);mycurrent_cell=document.createElement("td");mycurrent_cell.style.width="180px";M=document.createTextNode("Trust New Organization");mycurrent_cell.appendChild(M);mycurrent_row.appendChild(mycurrent_cell);mycurrent_cell=document.createElement("td");mycurrent_cell.style.width="100px";var K=document.createElement("a");K.setAttribute("href","javascript:iFactor.StormCenter.showTrustTable('curOrg');");K.className="hlinkAccount";var L=document.createElement("img");L.src="images/addbutton.JPG";K.appendChild(L);mycurrent_cell.appendChild(K);mycurrent_row.appendChild(mycurrent_cell);N.appendChild(mycurrent_row)};var A=this.GetIFactorUserToken();var B={prepare:function(E){return E},call:function(F){var E=proxies.IFCommonService.GetTrustedOrganizationNames;E.func=this.call.func;E.onException=this.call.onException;E(A)},finish:D,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.iFactorBreakTrustRelationship=function(F,E){var C=this;var D=function(G){if(F=="trustedOrgName"){C.iFactorGetTrustedOrganizationNames()}else{if(F=="trustingOrgName"){C.iFactorGetTrustingOrganizationNames()}}};var A=config.iFactorUserToken;var B={prepare:function(G){return G},call:function(H){var G=proxies.IFCommonService.BreakTrustRelationship;G.func=this.call.func;G.onException=this.call.onException;G(A,E)},finish:D,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.showTrustTable=function(A){if(A=="curOrg"){if(document.getElementById("showCurTrustTable")){document.getElementById("showCurTrustTable").style.display="block"}}else{if(A=="otherOrg"){if(document.getElementById("otherOrgTokenResult")){document.getElementById("otherOrgTokenResult").style.display="block"}}}};__stormcenter.prototype.hideTrustTable=function(A){if(A=="curOrg"){if(document.getElementById("showCurTrustTable")){document.getElementById("showCurTrustTable").style.display="none"}}else{if(A=="otherOrg"){if(document.getElementById("otherOrgTokenResult")){document.getElementById("otherOrgTokenResult").style.display="none"}}}};__stormcenter.prototype.iFactorPopulatePageIFrame=function(){var B=iFactor.common.config.IFactorStreetlightoutagesURL;var D=iFactor.common.orgName+"guest";var C;var A=null;A=iFactor.StormCenter.checkRadioSelection(document.mainForm.coderadio);if(A!=null&&A=="asp"){C='At a bare minimum, your ASP Embed code should look like this:\n<div class="streetlightmap" style="position:relative;width:768px;border:1px solid #a5b2bd" scrolling="no" width="768px" height="550px">\n\n<%\n//provide the EMBED page with parameter values width, height, username, reportformlayout(left,notleft)\nString SLOUrl ="'+B+"embed.aspx?username="+D+'&width=768&height=550&reportformlayouttype=left";\n\n//create a HttpWeb request based on the uri string.\nSystem.Net.HttpWebRequest request = (System.Net.HttpWebRequest)System.Net.WebRequest.Create(SLOUrl);\n\n//change this to the domain name in the URL that you will be presenting this page to \nrequest.Referer = "www.streetlightoutages.com";\n\n//get the HTML response..\nSystem.Net.HttpWebResponse response = (System.Net.HttpWebResponse)request.GetResponse();\n\nString enc = response.ContentEncoding;\nif (enc.Equals(""))  { \n enc = "utf-8";  //default \n}\n\nEncoding encode = System.Text.Encoding.GetEncoding(enc);\n\n//create a StreamReader object and get the stream containing the HTML response returned by server with the required encoding format\nSystem.IO.StreamReader readStream = new System.IO.StreamReader(response.GetResponseStream(), encode);\nResponse.Write(readStream.ReadToEnd());\n\n//close the StreamReader\nreadStream.Close();\n%>\n\n</div>\n'}else{C='At a bare minimum, your <iframe> tag should look like this:\n<iframe src ="'+B+"embed.aspx?username="+D+'">Your browser does not support iFrames</iframe>\n\nYou can control the size and shape of the map by specifying the "width" and "height" parameters.  You can also style the <iframe> with standard CSS markup.\n\nFor example:\n\n<iframe class="streetlightmap" src ="'+B+"embed.aspx?width=768&height=550&username="+D+'" style="width:768px;border:1px solid #a5b2bd" scrolling="no" width="768px" height="550px" frameborder="0">Your browser does not support iFrames</iframe>'}document.mainForm.pageIframe.value=C};__stormcenter.prototype.iFactorPopulateInviteShortMessage=function(){var C=this;var D=function(E){var J=E.getElementsByTagName("firstname")[0];var L=iFactor.common.getXMLNodeValue(J).replace(/^\s+|\s+$/g,"");var I=E.getElementsByTagName("lastname")[0];var F=iFactor.common.getXMLNodeValue(I).replace(/^\s+|\s+$/g,"");var H=iFactor.common.fullOrgName;var G="";if(L==null||L=="null"||L==""){G=F}if(L!=null&&L!="null"&&F!=null&&F!="null"&&F!=""&&L!=""){G=L+" "+F}if(F==null||F=="null"||F==""){G=L}var K='You have been invited to join the organization "'+H+'" on StreetLightOutages.com by '+G+".";document.getElementById("shortMessage").value=K};var A=config.iFactorUserToken;var B={prepare:function(E){return E},call:function(F){var E=proxies.IFCommonService.GetUserDetails;E.func=this.call.func;E.onException=this.call.onException;E(A)},finish:D,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.iFactorGetOrganizationInfoForUserToken=function(){var C=this;var D=function(E){var G=E.getElementsByTagName("name")[0];var I=iFactor.common.getXMLNodeValue(G);var H=E.getElementsByTagName("fullname")[0];var F=iFactor.common.getXMLNodeValue(H);if(I!=null&&I!=""){I=I.replace(/^\s+|\s+$/g,"");F=F.replace(/^\s+|\s+$/g,"");iFactor.common.orgName=I;iFactor.common.fullOrgName=F;document.mainForm.orgName.value=I+" ("+F+")";C.iFactorPopulateOrgTrustList();C.iFactorPopulatePageIFrame();C.iFactorPopulateInviteShortMessage()}};var A=this.GetIFactorUserToken();var B={prepare:function(E){return E},call:function(F){var E=proxies.IFCommonService.GetOrganizationInfoForUserToken;E.func=this.call.func;E.onException=this.call.onException;E(A)},finish:D,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.loadDisplayConfiguration=function(A){var E=this;var F=function(I){var G=YAHOO.lang.JSON.parse(I);var J;var H=iFactor.common.config;for(J in G){if(G.hasOwnProperty(J)){H[J]=G[J]}}if(A=="load"){E.loadStormCenterMap()}E.displaySettings();return };var B=function(){window.location=iFactor.common.config.IFactorStreetlightoutagesURL+"index.aspx"};var C=this.GetIFactorUserToken();var D={prepare:function(G){return G},call:function(H){var G=proxies.IFCommonService.GetConfigurations;G.func=this.call.func;G.onException=this.call.onException;G(C)},finish:F,onException:B};ajax.Start(D)};__stormcenter.prototype.gotoIncident=function(E,D,C){var A="Click here for incident: "+C;if(window.frames!=null&&window.frames.length>0){var B=document.getElementById("managementFrame");if(B.contentWindow){B.contentWindow.iFactor.StormCenter.gotoLatLng(E,D,"reportedIncidents",C,A)}else{window.frames[0].iFactor.StormCenter.gotoLatLng(E,D,"reportedIncidents",C,A)}}};__stormcenter.prototype.AdminCheckboxClicked=function(H){var D=H.id;var C=this.doc.getElementById(H.id);var E=(C.checked==true);var G=null;if(C.checked){G=proxies.IFCommonService.AddAdminUser}else{G=proxies.IFCommonService.RemoveAdminUser}var F=function(J){};var A=function(J){C.checked=!E;iFactor.StormCenter.handleSOAPException(J)};var I=this.GetIFactorUserToken();var B={prepare:function(J){return J},call:function(J){G.func=this.call.func;G.onException=this.call.onException;G(I,D)},finish:F,onException:A};ajax.Start(B)};__stormcenter.prototype.RemoveUser=function(E){var C=this;var D=function(F){C.showAlertBox(F);callMemberRefresh()};var A=this.GetIFactorUserToken();var B={prepare:function(F){return F},call:function(G){var F=proxies.IFCommonService.RemoveUser;F.func=this.call.func;F.onException=this.call.onException;F(A,E)},finish:D,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.displaySettings=function(){var B=this;this.doc=window.document;var A=iFactor.common.config;if(A!=null&&A!=""){this.doc.getElementById("mapLat").value=A.start_lat;this.doc.getElementById("mapLong").value=A.start_long;this.doc.getElementById("mapType").value=A.map_type;this.doc.getElementById("theme").value=A.themeInfo;B.setThemeStyle(A.themeInfo);B.setZoomConfiguration(A.max_zoom_level,A.min_zoom_level,A.start_zoom);B.setMapTypeConfiguration(A.map_type);B.setLatLngConfiguration()}};__stormcenter.prototype.GetIFactorUserToken=function(){if(window.document.getElementById("tokenTxt")){config.iFactorUserToken=unescape(window.document.getElementById("tokenTxt").value)}return config.iFactorUserToken};__stormcenter.prototype.controlSession=function(){var A="";A=window.document.getElementById("tokenTxt").value;if(A!=""&&A!=null&&A!="undefined"){document.getElementById("manageControl").style.display="inline";document.getElementById("adminControl").style.display="inline";document.getElementById("logoutControl").style.display="inline"}};__stormcenter.prototype.controlLayer=function(){var B=iFactor.common.getArguments()["show"];if(B=="login"){var D=["loginContent"];this.showContent(D);var F=["indexContent"];this.hideContent(F);function A(H){if(document.loginForm.username.value!=""&&document.loginForm.password.value!=""){iFactor.StormCenter.iFactorGetUserToken(document.loginForm.username.value,document.loginForm.password.value,document.loginForm.expiryminutes.value)}else{iFactor.StormCenter.showAlertBox("E-mail and password Cannot be empty");iFactor.StormCenter.clearField(document.loginForm)}}function G(H){document.getElementById("username").value="";document.getElementById("password").value="";iFactor.StormCenter.refreshContent()}var C=new YAHOO.widget.Button("login");C.on("click",A);var E=new YAHOO.widget.Button("cancel");E.on("click",G)}else{var D=["indexContent"];this.showContent(D);var F=["loginContent"];this.hideContent(F)}};__stormcenter.prototype.ForgotPassword=function(){var E=["loginContent","indexContent"];this.hideContent(E);var C=["forgotContent"];this.showContent(C);function B(G){iFactor.StormCenter.iFactorResetUserPassword(document.resetPwdForm.resetusername.value)}function F(G){iFactor.StormCenter.clearField(document.resetPwdForm);iFactor.StormCenter.refreshContent()}var D=new YAHOO.widget.Button("resetPwd");D.on("click",B);var A=new YAHOO.widget.Button("cancelPwd");A.on("click",F)};__stormcenter.prototype.showAlertBox=function(A){this.dialog=new YAHOO.widget.SimpleDialog("responsePanel",{width:"360px",fixedcenter:true,modal:true,close:true,draggable:false,visible:false,zIndex:500,constraintoviewport:false,hideaftersumbit:false,buttons:[{text:"OK",handler:function(){this.hide()},isDefault:true}],icon:YAHOO.widget.SimpleDialog.ICON_INFO});this.dialog.setHeader("Confirmation");this.dialog.setBody(A);this.dialog.render(document.body);this.dialog.show()};__stormcenter.prototype.refreshContent=function(){var B=["forgotContent","loginContent"];this.hideContent(B);var A=["indexContent"];this.showContent(A)};__stormcenter.prototype.shownewUserPanel=function(){function B(D){iFactor.StormCenter.iFactorRegisterOrganization()}function C(D){window.location.href="index.aspx"}this.register=new YAHOO.widget.Button("register");this.register.on("click",B);this.register.set("disabled",true);var A=new YAHOO.widget.Button("cancelAccount");A.on("click",C)};__stormcenter.prototype.enableRegister=function(A){if(A.checked){this.register.set("disabled",false)}else{this.register.set("disabled",true)}};__stormcenter.prototype.iFactorGetUserToken=function(E,A,B){var D=function(G){var F=G;if(F!=null||F!=""){F=escape(F).replace(/\+/g,"%2B");window.location=iFactor.common.config.IFactorStreetlightoutagesURL+"main.aspx?usertoken="+F}};var C={prepare:function(F){return F},call:function(G){var F=proxies.IFCommonService.GetUserToken;F.func=this.call.func;F.onException=this.call.onException;F(E,A,B)},finish:D,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(C)};__stormcenter.prototype.iFactorResetUserPassword=function(D){var C=function(E){iFactor.StormCenter.showAlertBox(E);iFactor.StormCenter.showloginPanel()};var A=function(E){iFactor.StormCenter.showAlertBox(E.description);iFactor.StormCenter.showAlertBox("Incorrect E-mail or Password\n\n"+E);iFactor.StormCenter.clearField(document.resetPwdForm);iFactor.StormCenter.refreshContent()};var B={prepare:function(E){return E},call:function(F){var E=proxies.IFCommonService.ResetUserPassword;E.func=this.call.func;E.onException=this.call.onException;E(D)},finish:C,onException:A};ajax.Start(B)};__stormcenter.prototype.iFactorCreateUser=function(){document.getElementById("createUser").style.display="block";var D=function(){iFactor.StormCenter.clearField(document.registerForm);this.cancel();this.hide()};var A=function(F){var E=this.getData();if(this.validate()){iFactor.StormCenter.createUser(E.fname,E.lname,E.newusername,E.newpassword,E.email,E.phone);iFactor.StormCenter.clearField(document.registerForm);this.hide()}};var B=new YAHOO.widget.Dialog("createUser",{width:"330px",fixedcenter:true,visible:false,close:false,draggable:true,zIndex:400,modal:true,constraintoviewport:true,hideaftersumbit:true,buttons:[{text:"Submit",handler:A,isDefault:true},{text:"Cancel",handler:D}]});B.validate=function(){var E=this.getData();var F=true;var G=E.phone.replace(/[\(\)\.\-\ ]/g,"");if(E.fname==""||E.lname==""||E.newusername==""||E.newpassword==""||E.phone==""){iFactor.StormCenter.showAlertBox("Empty String");F=false}else{if(!C(E.phone)){iFactor.StormCenter.showAlertBox("Phone Number should be numeric");F=false}else{if(isNaN(parseInt(G))){iFactor.StormCenter.showAlertBox("Invalid phone");F=false}else{if(!(G.length==10)){iFactor.StormCenter.showAlertBox("Please include the area code and phone number");F=false}else{F=true}}}}return F};function C(F){var E;for(E=0;E<F.length;E++){var G=F.charAt(E);if(((G<"0")||(G>"9"))){return false}}return true}B.render(document.body);B.show()};__stormcenter.prototype.createUser=function(C,H,I,A,G,E){var F=function(K){iFactor.StormCenter.showAlertBox(K);return };var B=function(){iFactor.StormCenter.showAlertBox("User '"+I+"' already exists")};var J=this.GetIFactorUserToken();var D={prepare:function(K){return K},call:function(L){var K=proxies.IFCommonService.CreateUser;K.func=this.call.func;K.onException=this.call.onException;K(J,C,H,I,A,G,E)},finish:F,onException:B};ajax.Start(D)};__stormcenter.prototype.iFactorRegisterTrustToken=function(D){var C=this;var E=function(F){iFactor.StormCenter.showAlertBox(F);C.iFactorGetTrustingOrganizationNames()};var A=this.GetIFactorUserToken();var B={prepare:function(F){return F},call:function(G){var F=proxies.IFCommonService.RegisterTrustToken;F.func=this.call.func;F.onException=this.call.onException;F(A,D)},finish:E,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.iFactorGetOrganizationTrustToken=function(A){var D=function(E){if(E!=null||E!=""){document.getElementById("createTokenResult").innerHTML="Send this token to your contact at "+A+" and ask them to register it.  Once the token has been registered, "+A+" can view your assets and incidents.  Note that at any time you can break the trust relationship be clicking <img align='top' src='images/closebutton.jpg'/> next to the name of a trusted organization.<br/><br/>";document.getElementById("trustUserToken").innerHTML=E}};var B=this.GetIFactorUserToken();var C={prepare:function(E){return E},call:function(F){var E=proxies.IFCommonService.GetOrganizationTrustToken;E.func=this.call.func;E.onException=this.call.onException;E(B,A)},finish:D,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(C)};__stormcenter.prototype.iFactorSetDomains=function(){var E=function(F){};var B=function(){iFactor.StormCenter.showAlertBox("Incorrect Format")};var A=document.getElementById("domaintxt").value;var C=this.GetIFactorUserToken();var D={prepare:function(F){return F},call:function(G){var F=proxies.IFCommonService.SetDomains;F.func=this.call.func;F.onException=this.call.onException;F(C,A)},finish:E,onException:B};ajax.Start(D)};__stormcenter.prototype.iFactorInviteMembers=function(){var E=function(F){iFactor.StormCenter.showAlertBox(F)};var D=document.getElementById("invite").value;var A=document.getElementById("shortMessage").value;var B=this.GetIFactorUserToken();var C={prepare:function(F){return F},call:function(G){var F=proxies.IFCommonService.SendInvitationEmails;F.func=this.call.func;F.onException=this.call.onException;F(B,D,A)},finish:E,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(C)};__stormcenter.prototype.redirect=function(B){var A=new YAHOO.widget.SimpleDialog("responsePanel",{width:"360px",fixedcenter:true,modal:true,close:true,draggable:false,visible:false,zIndex:500,constraintoviewport:false,hideaftersumbit:false,buttons:[{text:"OK",handler:function(){this.hide();window.location=iFactor.common.config.IFactorStreetlightoutagesURL+"index.aspx"},isDefault:true}],icon:YAHOO.widget.SimpleDialog.ICON_INFO});A.setHeader("Confirmation");A.setBody(B);A.render(document.body);A.show()};__stormcenter.prototype.iFactorRegisterOrganization=function(){var C=function(E){iFactor.StormCenter.redirect(E);return };var A=function(){iFactor.StormCenter.showAlertBox("Incorrect Format")};var D=window.document.registerForm;if(D.adminUsername.value==""||D.adminUsername.value==null){iFactor.StormCenter.showAlertBox("Email field cannot be left blank");return }else{if(D.organizationName.value==""||D.organizationName.value==null||D.fullOrganizationName.value==""||D.fullOrganizationName.value==null){iFactor.StormCenter.showAlertBox("Organization name field cannot be left blank.");return }else{if(D.adminFirstName.value==""||D.adminFirstName.value==null){iFactor.StormCenter.showAlertBox("First name field cannot be left blank.");return }else{if(D.adminLastName.value==""||D.adminLastName.value==null){iFactor.StormCenter.showAlertBox("Last name field cannot be left blank.");return }else{if(D.adminPhone.value==""||D.adminPhone.value==null){iFactor.StormCenter.showAlertBox("Phone field cannot be left blank.");return }else{if(!this.validateEmailInput(D.adminUsername.value)){iFactor.StormCenter.showAlertBox("'"+D.adminUsername.value+"' is not in a valid e-mail format.  Please try again.");return }else{if(D.adminPassword.value!==D.adminConfirmPassword.value){iFactor.StormCenter.showAlertBox("Please re-enter your password.  The confirmation does not match.");return }}}}}}}var B={prepare:function(E){return E},call:function(F){var E=proxies.IFCommonService.RegisterOrganization;E.func=this.call.func;E.onException=this.call.onException;E(D.organizationName.value,D.fullOrganizationName.value,D.adminFirstName.value,D.adminLastName.value,D.adminUsername.value,D.adminPassword.value,D.adminPhone.value)},finish:C,onException:A};ajax.Start(B)};__stormcenter.prototype.validateEmailInput=function(A){var B=false;var C=new RegExp("[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+(?:[A-Z]{2}|com|org|net|gov|mil|biz|info|mobi|name|aero|jobs|museum)\\b");if(C.test(A)){B=true}return B};__stormcenter.prototype.iFactorUpdateConfiguration=function(){var K=this.GetIFactorUserToken();var J=proxies.IFCommonService.GetConfigurations;J.func=null;J.onException=iFactor.StormCenter.handleSOAPException;var L=J(K);var G=YAHOO.lang.JSON.parse(L);var F;var C;var A=["map_type","max_viewable_lat","max_viewable_lng","min_viewable_lat","min_viewable_lng","max_zoom_level","min_zoom_level","start_lat","start_long","start_zoom","themeInfo"];var B=iFactor.common.config;for(i in A){F=A[i];C=B[F];G[F]=C}var E=YAHOO.lang.JSON.stringify(G);var H=function(M){};var I=proxies.IFCommonService.SetConfigurations;var D={prepare:function(M){return M},call:function(M){I.func=this.call.func;I.onException=this.call.onException;I(K,E)},finish:H,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(D)};__stormcenter.prototype.iFactorUpdateIntegration=function(){var E=document.integrateForm;var C=null;var G=function(I){};var B=this.GetIFactorUserToken();var A=proxies.IFCommonService.SetIncidentNotificationInformation;var H=E.incidentNotificationURL.defaultValue;C=iFactor.StormCenter.checkRadioSelection(E.httpCallradio);var F="";if(E.incidentNotificationURL.value.match(H)==null&&E.incidentNotificationURL.value.length!=0&&C!=null){F="["+C+"]"+E.incidentNotificationURL.value}else{E.incidentNotificationURL.value=""}var D={prepare:function(I){return I},call:function(I){A.func=this.call.func;A.onException=this.call.onException;A(B,E.incidentNotificationEmailList.value,F)},finish:G,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(D)};__stormcenter.prototype.loadIntegration=function(){var D=document.integrateForm;var C=this;var E=function(G){var H=YAHOO.lang.JSON.parse(G);D.incidentNotificationEmailList.value=H.incidentNotificationEmailList||"";if(H.incidentNotificationURL.length!=0){var F=H.incidentNotificationURL.split("]");if(F.length>0){if(F[0].match("POST")!=null){D.httpCallradio[0].checked=true}else{if(F[0].match("PUT")!=null){D.httpCallradio[1].checked=true}}D.incidentNotificationURL.value=F[1]}}};var A=this.GetIFactorUserToken();var B={prepare:function(F){return F},call:function(G){var F=proxies.IFCommonService.GetIncidentNotificationInformation;F.func=this.call.func;F.onException=this.call.onException;F(A)},finish:E,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.logout=function(){document.getElementById("<%= LogoutCtrl.ClientID %>").click()};__stormcenter.prototype.hideContent=function(B){if(B&&B.length>0){for(var A=0;A<=B.length;A=A+1){var C=B[A];if(window.document.getElementById(C)){window.document.getElementById(C).style.display="none"}}}};__stormcenter.prototype.showContent=function(B){if(B&&B.length>0){for(var A=0;A<=B.length;A=A+1){var C=B[A];if(window.document.getElementById(C)){window.document.getElementById(C).style.display="block"}}}};__stormcenter.prototype.setLatLngConfiguration=function(){var D=this.doc.getElementById("mapLat").value;var B=this.doc.getElementById("mapLong").value;var A=this.doc.getElementById("startZoom").value;if((D!=null)&&(B!=null)&&(A!=null)){config.start_lat=D;config.start_long=B;config.start_zoom=A;var C=new VELatLong(D,B);this.map.SetCenterAndZoom(C,A)}};__stormcenter.prototype.ensureZoomLevel=function(){var C=this.doc.getElementById("maxZoom");var B=this.doc.getElementById("minZoom");var A=this.doc.getElementById("startZoom");var D=parseInt(B.options[B.selectedIndex].value);var F=parseInt(C.options[C.selectedIndex].value);var E=parseInt(A.options[A.selectedIndex].value);if(D<F){D=F+1}else{if(E>D){E=D}else{if(E<F){E=F}}}C.value=F;B.value=D;A.value=E;this.setZoomConfiguration(F,D,E);this.map.SetZoomLevel(E)};__stormcenter.prototype.setZoomConfiguration=function(A,F,C){var E=this.doc.getElementById("maxZoom");var D=this.doc.getElementById("minZoom");var B=this.doc.getElementById("startZoom");D.options[F-1].selected=true;B.options[C-1].selected=true;E.options[A-1].selected=true;config.max_zoom_level=A;config.min_zoom_level=F;config.start_zoom=C};__stormcenter.prototype.createZoomOption=function(){var A=this.map;var I=0;if(A){I=GetCenterLatLong(A).Latitude}this.doc=window.document;var J=this.doc.getElementById("maxZoom");var K=this.doc.getElementById("minZoom");var E=this.doc.getElementById("startZoom");var B=[J,K,E];var F=[];var H=18;for(var D=0;D<=H;++D){F[D]=D+1}for(var C=0;C<B.length;++C){for(var G=0;G<F.length;++G){this.addOption(B[C],this.calculateScaleString(I,F[G]),F[G])}}};__stormcenter.prototype.addOption=function(C,B,D){var A=document.createElement("OPTION");A.text=B;A.value=D;C.options.add(A)};__stormcenter.prototype.setMapTypeConfiguration=function(A){if(A!=null&&A!=""){config.map_type=A;this.map.SetMapStyle(A)}};__stormcenter.prototype.setThemeStyle=function(C){var B=this.doc.getElementById("MSVE_navAction_leftBackground");var F=this.doc.getElementById("MSVE_navAction_compassBackground");var D=this.doc.getElementById("MSVE_navAction_topBackground");var A=this.doc.getElementById("Compass");if(C!=null&&C!=""){if(B&&F&&D&&A){config.themeInfo=C;var E=C.compassColor;this.setCellStyle(B.style,E);this.setCellStyle(F.style,E);this.setCellStyle(D.style,E);this.setMapControlImage(A.style,E)}}};__stormcenter.prototype.setCellStyle=function(A,B){if(A&&B){A.backgroundColor=B}};__stormcenter.prototype.setMapControlImage=function(B,D){var C=iFactor.common.config.IFactorStreetlightoutagesURL+"images";var A=C+"/compass_"+D.replace(/\#/g,"%23")+".gif";B.background="transparent url("+A+") no-repeat"};__stormcenter.prototype.onMapPan=function(){this.doc=window.document;var A=GetCenterLatLong(this.map);var D=A.Latitude;var C=A.Longitude;var B=GetZoomLevel(this.map);if(this.doc.getElementById("mapLat")){this.doc.getElementById("mapLat").value=D;this.doc.getElementById("mapLong").value=C;this.doc.getElementById("mapType").value=this.map.GetMapStyle();this.doc.getElementById("startZoom").value=B;this.setLatLngConfiguration();this.ensureZoomLevel()}};__stormcenter.prototype.calculateScaleString=function(J,G){var L=[9000,4000,2000,1000,500,250,100,70,30,15,8,4,2,1,0.5,0.25,0.1,0.06,0.03,0];var B=[500,250,100,60,30];var A=100;var F=150;var D=96;var H=(Math.cos(J*Math.PI/180)*2*Math.PI*6378137)/(256*Math.pow(2,G));var K=(H*F)/1000;var I=K*0.621371192;var E;for(i=0;i<L.length;i=i+1){E=L[i];if(I>=E){break}}if(E<0.5){var C=I*1760;for(j=0;j<B.length;j=j+1){E=B[j];if(C>=E){break}}return E+" yards"}else{return E+" miles"}};__stormcenter.prototype.loadYUIButtons=function(){function C(K){var J=document.getElementById("newOrg").value;if(J!=""){iFactor.StormCenter.iFactorGetOrganizationTrustToken(J)}}function H(K){var J=null;if(document.mainForm.trustToken){J=document.mainForm.trustToken.value;if(J!=""&&J!=null){iFactor.StormCenter.iFactorRegisterTrustToken(J)}else{iFactor.StormCenter.showAlertBox("Trust token Cannot be empty")}}}function E(J){}function A(J){iFactor.StormCenter.iFactorUpdateConfiguration()}function G(J){iFactor.StormCenter.loadDisplayConfiguration("revert")}function D(J){iFactor.StormCenter.iFactorSetDomains()}function B(J){iFactor.StormCenter.iFactorInviteMembers()}function F(J){iFactor.StormCenter.iFactorUpdateIntegration()}function I(J){iFactor.StormCenter.loadIntegration()}this.onCreateToken=new YAHOO.widget.Button("createToken");this.onCreateToken.on("click",C);this.onCreateToken.set("disabled",true);this.onRegisterToken=new YAHOO.widget.Button("registerToken");this.onRegisterToken.on("click",H);this.onRegisterToken.set("disabled",true);this.onSaveDomains=new YAHOO.widget.Button("saveDomains");this.onSaveDomains.on("click",D);this.onCancelToken=new YAHOO.widget.Button("cancelToken");this.onCancelToken.on("click",E);this.onSaveChanges=new YAHOO.widget.Button("saveChanges");this.onSaveChanges.on("click",A);this.onRevertChanges=new YAHOO.widget.Button("revertChanges");this.onRevertChanges.on("click",G);this.onSend=new YAHOO.widget.Button("send");this.onSend.on("click",B);this.onSaveIntegration=new YAHOO.widget.Button("saveIntegration");this.onSaveIntegration.on("click",F);this.onRevertIntegration=new YAHOO.widget.Button("revertIntegration");this.onRevertIntegration.on("click",I)};__stormcenter.prototype.passwordStrength=function(A){var C=[];C[0]="Weak";C[1]="Medium";C[2]="Strong";var B=0;if(A.match(/[a-z]/)){B=B+1}if((A.match(/.[!,@,#,$,%,^,&,*,?,_,~,-,(,)]/))&&(A.match(/[A-Z]/))){B=B+1}if(A.length>5){B=B+1}document.getElementById("passwordDescription").innerHTML=C[B];document.getElementById("passwordStrength").className="strength"+B};__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=="mapLat"){this.setLatLngConfiguration();return false}if(B=="mapLong"){this.setLatLngConfiguration();return false}}else{return true}};__stormcenter.prototype.enablecreateTrust=function(A){if(A=="createToken"&&this.onCreateToken!=null){this.onCreateToken.set("disabled",false)}else{if(A=="registerToken"&&this.onRegisterToken!=null){this.onRegisterToken.set("disabled",false)}}};function formValidation(B){var C=true;var A=new RegExp(/[a-zA-Z]/);for(i=0;i<B.length;i++){if(!B.charAt(i).match(A)){C=false}}if(C==false){window.document.getElementById("errorMessage").innerHTML="<img align='top' src='images/closebutton.jpg'/>Organization name cannot contain any special characters.Example 'pepco'"}else{window.document.getElementById("errorMessage").innerHTML=""}}__stormcenter.prototype.clearField=function(A){for(i=0;i<A.elements.length;i++){if((A.elements[i].type=="text")||(A.elements[i].type=="password")){A.elements[i].value=""}}if(document.getElementById("createUser")){if(document.getElementById("createUser").style.display=="block"){document.getElementById("passwordDescription").innerHTML="Password not entered";document.getElementById("passwordStrength").className="strength0"}}};__stormcenter.prototype.checkRadioSelection=function(A){var C=null;if(A){for(var B=0;B<A.length;B++){if(A[B].checked){C=A[B].value}}}return C};__stormcenter.prototype.callreSubmitIncidents=function(){var C=function(D){var E="Your incident report has been submitted.<br/><br/>StreetLightOutages.com appreciates your help in keeping our communities safe by reporting interruptions of service in your area.";iFactor.StormCenter.showAlertBox(E);callManagemnetRefresh();window.frames[0].iFactor.StormCenter.refreshMap();return };var A=this.GetIFactorUserToken();var B={prepare:function(D){return D},call:function(E){var D=proxies.IFIncidentService.ResubmitAllRejectedIncidents;D.func=this.call.func;D.onException=this.call.onException;D(A)},finish:C,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};__stormcenter.prototype.gotoReportedIncident=function(D,C,B){var A="Click here for incident: "+B;if(window.frames!=null&&window.frames.length>0){if(window.frames[0].document.getElementById("map")){window.frames[0].iFactor.StormCenter.gotoLatLng(D,C,"reportedIncidents",B,A)}}};__stormcenter.prototype.gotoReolvedIncident=function(D,C,B){var A="Click here for incident: "+B;if(window.frames!=null&&window.frames.length>0){if(window.frames[0].document.getElementById("map")){window.frames[0].iFactor.StormCenter.gotoLatLng(D,C,"resolvedIncidents",B,A)}}};__stormcenter.prototype.changeStatusBySLOID=function(G,F){var B=iFactor.common.config;var H=F;var D;if(B.management_status_transition){D=B.management_status_transition[H]}var E=function(J){if(J==true){callManagemnetRefresh();if(window.frames!=null&&window.frames.length>0){if(window.frames[0].document.getElementById("map")){window.frames[0].iFactor.StormCenter.refreshMap()}}}};var A=function(J){iFactor.StormCenter.handleSOAPException("This incident does not belong to your organization!")};var I=this.GetIFactorUserToken();var C={prepare:function(J){return J},call:function(K){var J=proxies.IFIncidentService.SetIncidentStatusBySLOID;J.func=this.call.func;J.onException=this.call.onException;J(I,parseInt(G),D)},finish:E,onException:A};ajax.Start(C)};__stormcenter.prototype.commentbox=function(C){var A=function(){iFactor.StormCenter.commentUpdate(this.getData().comments,C);this.hide()};var D=function(){this.hide()};var B=new YAHOO.widget.Dialog("responsePanel",{width:"50px",fixedcenter:true,modal:true,close:true,draggable:false,visible:false,zIndex:500,constraintoviewport:false,hideaftersumbit:false,buttons:[{text:"Submit",handler:A}]});B.callback={success:A,failure:D};B.setHeader("Comment");if(iFactor.common.config.commentEmailNotification!=undefined){B.setBody('<form name="comments" align="center"><textarea id="comments" name="comments" cols="40" rows="5"></textarea></form><font color="red">'+iFactor.common.config.commentEmailNotification)+"</font>"}else{B.setBody('<form name="comments" align="center"><textarea id="comments" name="comments" cols="40" rows="5"></textarea></form>')}B.render(document.body);B.show()};__stormcenter.prototype.commentUpdate=function(E,D){var A=this.GetIFactorUserToken();var C=function(F){callManagemnetRefresh()};var B={prepare:function(F){return F},call:function(G){var F=proxies.IFIncidentService.UpdateComments;F.func=this.call.func;F.onException=this.call.onException;F(A,D,E)},finish:C,onException:iFactor.StormCenter.handleSOAPException};ajax.Start(B)};function handleSOAPException_session(A){if(A&&A.match("IFTokenExpired")){iFactor.StormCenter.showAlertBox("Your session has expired.  Please refresh your browser.")}else{if(A&&A.match("IFInsufficientRights")){iFactor.StormCenter.showAlertBox("You do not have sufficient rights for this action.")}else{if(A&&A.match("IFInvalidCredentials")){iFactor.StormCenter.showAlertBox("Username/password incorrect.")}else{alert(A)}}}};
