<%@ Control Language="VB" AutoEventWireup="false" CodeFile="ManageLogin.ascx.vb"
    Inherits="Controls_ManageLogin" %>
<%@ Register Src="~/Controls/CustomContent.ascx" TagName="CustomContent" TagPrefix="uc" %>
<style type="text/css">
    .style1
    {
        height: 44px;
    }
</style>

<script type="text/JavaScript">

    var isShift = false;

    window.onload = function() {
        var myBoxObject = new curvyCorners(settings, "ValidationSummary");
        myBoxObject.applyCornersToAll();
    }

    function hideRoundBox() {

        if (document.getElementById("summaryBox"))
            document.getElementById("summaryBox").className = "HideValidationSummaryBox";
        if (document.getElementById("summaryBox2"))
            document.getElementById("summaryBox2").className = "HideValidationSummaryBox";
        if (document.getElementById("divMessageCode"))
            document.getElementById("divMessageCode").className = "HideValidationSummaryBox";
    }
    function isNumeric(keyCode) {

        if (keyCode == 16)

            isShift = true;

        return ((keyCode >= 48 && keyCode <= 90 || keyCode == 8 || keyCode == 9 || keyCode == 46 || 

            (keyCode >= 96 && keyCode <= 105)) && isShift == false);

    }

    function keyUP(keyCode) {

        if (keyCode == 16)

            isShift = false;

    }

    function valcodematch(source, args) {

        var NewCodeFieldName = 'ctl00$ContentPlaceHolderHome$ManageLogin1$txtNewCode';
        var RetypeCodeFieldName = 'ctl00$ContentPlaceHolderHome$ManageLogin1$txtRetypeNewCode';
        
        if (document.forms[0].elements[NewCodeFieldName].value
        != document.forms[0].elements[RetypeCodeFieldName].value) 
        {
            document.forms[0].elements[NewCodeFieldName].value = "";
            document.forms[0].elements[RetypeCodeFieldName].value = "";
            args.IsValid = false;            
        }
        else {
             args.IsValid = true;
        }
    }   
</script>

<!-- panel displaying username and password sections -->
<asp:Panel ID="securityCodePanel" runat="server" Visible="true">
    <div class="innerbox" style="width: 650px!important;">
        <p class="innerHeader2">
            Security Code</p>
        <uc:CustomContent ID="SecuritycodeIntro" ContentKey="myaccount:myprofile:securityCode:introText"
            runat="server" />
        <asp:Panel ID="pnlSecuritycodeIntro" runat="server" Visible="false" DefaultButton="btnSaveCode">
            <!-- there should be no space between summarBox div and the asp:label -->
            <div id="divMessageCode" style="padding: 10px;">
                <asp:Label ID="lblErrorCode" runat="server" Visible="false" Style="color: red"></asp:Label>
                <asp:Label ID="ltrMessageCode" runat="server" ForeColor="red"></asp:Label>
            </div>
        </asp:Panel>
        <span id="spnrequired" runat="server" style="padding-left: 10px; line-height: 2em;">
            <font color="red">*Required Fields</font></span>
        <table width="95%" border="0" cellpadding="0" cellspacing="0" style="margin-top: 10px;
            line-height: 22px; margin-left: 20px;">
            <tr>
                <td width="400" align="left">
                    <table border="0" cellpadding="0" cellspacing="0" style="margin-top: 10px; line-height: 22px;
                        margin-left: 20px;">
                        <tr>
                            <td id="tdlblSC" runat="server" width="29%" valign="top" style="text-align: right;">
                                Security Code&nbsp;
                            </td>
                            <td valign="middle" nowrap="nowrap">
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Label ID="lblSecurityCode" runat="server">****</asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a
                                    href="../customers/support.aspx?SupportArticleID=1955" target="_blank" tabindex="19997"
                                    id="lnkCMS" runat="server">?</a>
                            </td>
                        </tr>
                        <tr>
                            <td width="26%" valign="top" style="text-align: right;">
                                &gt;&nbsp;
                            </td>
                            <td valign="middle" nowrap="nowrap">
                                <asp:LinkButton ID="lbViewCode" runat="server">View or Change Code</asp:LinkButton>
                                &nbsp;&nbsp;
                            </td>
                        </tr>
                        <tr>
                            <td width="26%" valign="top">
                                &nbsp;
                            </td>
                            <td>
                            </td>
                        </tr>
                        <asp:Panel ID="pnlNewcode" runat="server">
                            <tr>
                                <td width="26%" valign="top" style="text-align: right;" nowrap="nowrap">
                                    <font color="red">*</font>New Security Code&nbsp;
                                </td>
                                <td>
                                    <asp:TextBox ID="txtNewCode" runat="server" Width="143px" TabIndex="10012" MaxLength="4"
                                        TextMode="Password" onfocus="this.value=''" ValidationGroup="sendCode" BorderStyle="NotSet"
                                        onkeyup="keyUP(event.keyCode)" onkeydown="return isNumeric(event.keyCode);"></asp:TextBox>
                                    &nbsp;&nbsp;<a href="../customers/support.aspx?SupportArticleID=1777" target="_blank"
                                        tabindex="19998">?</a>
                                </td>
                            </tr>
                            <tr>
                                <td width="26%" valign="top">
                                    &nbsp;
                                </td>
                                <td valign="top">
                                    <asp:RequiredFieldValidator ID="vldSecurityCodeRequired" runat="server" ControlToValidate="txtNewCode"
                                        SetFocusOnError="true" ValidationGroup="sendCode" Display="Dynamic" ErrorMessage="<b>Security Code</b> is required."></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="vldSecurityCodeNumeric" runat="server" ControlToValidate="txtNewCode"
                                        SetFocusOnError="true" ValidationGroup="sendCode" ValidationExpression="(^([0-9]{4,4})$)"
                                        Display="Dynamic" ErrorMessage="<b>Security Code</b> must be numeric and 4 digit long. "></asp:RegularExpressionValidator>
                                </td>
                            </tr>
                            <tr >
                                <td width="26%" valign="top" style="text-align: right;" nowrap="nowrap">
                                    <font color="red">*</font>Retype New Security Code&nbsp;
                                </td>
                                <td valign="top">
                                    <asp:TextBox ID="txtRetypeNewCode" runat="server" Width="143px" TabIndex="10013"
                                        MaxLength="4" TextMode="Password" onfocus="this.value=''" ValidationGroup="sendCode"
                                        onkeyup="keyUP(event.keyCode)" onkeydown="return isNumeric(event.keyCode);"></asp:TextBox>
                                </td>
                            </tr>
                            <tr>
                                <td width="26%" valign="top">
                                    &nbsp;
                                </td>
                                <td valign="top">
                                    <asp:RequiredFieldValidator ID="vldRetypeSecurityCodeRequired" runat="server" ControlToValidate="txtRetypeNewCode"
                                        SetFocusOnError="true" ValidationGroup="sendCode" Display="Dynamic" ErrorMessage="<b>Retype Security Code</b> is required."></asp:RequiredFieldValidator>
                                    <asp:RegularExpressionValidator ID="vldRetypeSecurityCodeNumeric" runat="server"
                                        ControlToValidate="txtRetypeNewCode" SetFocusOnError="true" ValidationGroup="sendCode"
                                        ValidationExpression="(^([0-9]{4,4})$)" Display="Dynamic" ErrorMessage="<b>Retype Security Code</b> must be numeric and 4 digit long. "></asp:RegularExpressionValidator>
                                     <asp:CustomValidator runat="server" ID="vldCodeCompare" ClientValidationFunction="valcodematch" Display="Dynamic" ErrorMessage="The information you entered did not match.  Please try again." ForeColor="Red" ValidationGroup="sendCode"></asp:CustomValidator>      
                                   
                                </td>
                            </tr>
                            <tr>
                                <td valign="top">
                                    &nbsp;
                                </td>
                                <td valign="top">
                                    <asp:ImageButton ID="btnSaveCode" runat="server" ImageUrl="saveChanges.ccom" AlternateText="Save Changes"
                                        TabIndex="10014" OnClientClick="hideRoundBox();" ValidationGroup="sendCode" />
                                    <asp:ImageButton ID="btnResetCode" runat="server" ImageUrl="reset.ccom" AlternateText="Reset"
                                        TabIndex="10015" OnClientClick="hideRoundBox();" ValidationGroup="sendCode" />
                                </td>
                            </tr>
                        </asp:Panel>
                    </table>
                </td>
                <td>
                    <uc:CustomContent ID="CustomContent2" ContentKey="myaccount:myprofile:securityCode:needHelp"
                        runat="server" />
                </td>
            </tr>
        </table>
        <br />
    </div>
</asp:Panel>
<asp:Panel ID="pnlCustomerIDAvailable" runat="server" Visible=false>
    <div class="innerbox" style="width: 650px!important;">
        <uc:CustomContent ID="CustomContent1" ContentKey="myaccount:myprofile:securityCode:CustomerIDNotAvailable"
            runat="server" />
    </div>
</asp:Panel>
<!-- panel displaying username and password sections -->
<asp:Panel ID="usernamePasswordPanel" runat="server" Visible="true" DefaultButton="btnSaveUPP">
    <div class="innerbox" style="width: 650px!important;">
        <p class="innerHeader2">
            Username &amp; Password</p>
        <asp:Panel ID="pnlNormalInstructions" runat="server" Visible="false" DefaultButton="btnSaveUPP">
            <!-- there should be no space between summarBox div and the asp:label -->
            <div id="summaryBox" style="padding: 10px;">
                <asp:Label ID="lblErrorUPP" runat="server" Visible="false" Style="color: red"></asp:Label>
                <asp:Label ID="ltrMessageUPP" runat="server" ForeColor="red"></asp:Label>
            </div>
            <uc:CustomContent ID="NormalInstructions" ContentKey="myaccount:myprofile:normalinfo"
                runat="server" />
        </asp:Panel>
        <asp:Panel ID="pnlAdditionalInfoNeededInstructions" runat="server" Visible="false"
            DefaultButton="btnSaveUPP">
            <uc:CustomContent ID="TxtAdditionalInfoNeeded" ContentKey="myaccount:myprofile:additionalinfoneeded"
                runat="server" />
        </asp:Panel>
        <span style="padding-left: 10px; line-height: 2em;"><font color="red">*Required Fields</font></span>
        <table width="95%" border="0" cellpadding="0" cellspacing="0" style="margin-top: 10px;
            line-height: 22px; margin-left: 20px;">
            <tr>
                <td width="26%" valign="top" style="text-align: right;">
                    <font color="red">*</font>Username&nbsp;
                </td>
                <td valign="top" nowrap="nowrap">
                    <asp:TextBox ID="txtUserName" runat="server" Width="143px" TabIndex="10001"></asp:TextBox>
                    &nbsp;<a href="../customers/support.aspx?SupportArticleID=1777" target="_blank" tabindex="19999">Username
                        Tips</a>
                </td>
            </tr>
            <tr>
                <td width="26%" valign="top">
                    &nbsp;
                </td>
                <td valign="top" nowrap="nowrap">
                    <asp:RequiredFieldValidator ID="vldUserNameRequired" runat="server" ControlToValidate="txtUserName"
                        SetFocusOnError="true" ValidationGroup="sendUPP" Display="Dynamic" ErrorMessage="<b>Username</b> is required."></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td width="26%" valign="top" style="text-align: right;">
                    <font color="red">*</font>Old Password&nbsp;
                </td>
                <td valign="top" nowrap="nowrap">
                    <asp:TextBox ID="txtCurrentPassword" TextMode="Password" runat="server" Width="143px"
                        TabIndex="10002"></asp:TextBox>&nbsp;(You must also provide your old password
                    to submit a new password)
                </td>
            </tr>
            <tr>
                <td width="26%" valign="top">
                    &nbsp;
                </td>
                <td valign="top" nowrap="nowrap">
                    <asp:RequiredFieldValidator ID="vldCurrentPasswordRequired" runat="server" ControlToValidate="txtCurrentPassword"
                        SetFocusOnError="true" ValidationGroup="sendUPP" Display="Dynamic" ErrorMessage="<b>Old Password</b> is required."></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td width="26%" valign="top" style="text-align: right;">
                    New Password&nbsp;
                </td>
                <td valign="top" nowrap="nowrap">
                    <asp:TextBox ID="txtPassword" runat="server" Width="143px" TabIndex="10003" MaxLength="20"
                        TextMode="Password" onfocus="this.value=''"></asp:TextBox>
                    &nbsp;<a href="../customers/support.aspx?SupportArticleID=1777" target="_blank" tabindex="19999">Password
                        Tips</a>
                </td>
            </tr>
            <tr>
                <td width="26%" valign="top">
                    &nbsp;
                </td>
                <td valign="top" nowrap="nowrap">
					<asp:RegularExpressionValidator ID="vldPasswordSpecialChar" runat="server" ControlToValidate="txtPassword"
						ErrorMessage="<b>Password</b> does not allow \(back slash) or &quot;(quotes)."
                        Text="" Display="Dynamic" ValidationExpression="^[^\\^&quot;]*$" 
                        ValidationGroup="sendUPP"></asp:RegularExpressionValidator>
                        
					<asp:RequiredFieldValidator ID="vldPwdRequired" runat="server" Text="" ValidationGroup="sendUPP"
                        ControlToValidate="txtPassword" Display="Dynamic" 
                        ErrorMessage="<b>Password</b> is a required field."></asp:RequiredFieldValidator>               
                        
                    <asp:RegularExpressionValidator runat="server" ID="revLength" ControlToValidate="txtPassword" Display="Dynamic" 
						ErrorMessage="Password Required. 8-20 characters in length.<br>" ForeColor="Red" ValidationGroup="sendUPP" 
						ValidationExpression=".{8,20}"></asp:RegularExpressionValidator>
						
					<asp:RegularExpressionValidator runat="server" ID="revNumber" ControlToValidate="txtPassword" Display="Dynamic" 
						ForeColor="Red" Text="Password must contain at least one number.<br>" ValidationExpression=".*[0-9]+.*" 
						ValidationGroup="sendUPP"></asp:RegularExpressionValidator>
						
					<asp:RegularExpressionValidator runat="server" ID="revUppercase" ControlToValidate="txtPassword" Display="Dynamic" 
						ForeColor="Red" Text="Password must contain at least one uppercase letter.<br>" ValidationExpression=".*[A-Z]+.*"	
						ValidationGroup="sendUPP"></asp:RegularExpressionValidator>
						
					<asp:RegularExpressionValidator runat="server" ID="revLowercase" ControlToValidate="txtPassword" Display="Dynamic" 
						ForeColor="Red" Text="Password must contain at least one lowercase letter.<br>" ValidationExpression=".*[a-z]+.*" 
						ValidationGroup="sendUPP"></asp:RegularExpressionValidator>                                         
                </td>
            </tr>
            <tr>
                <td width="26%" valign="top" style="text-align: right;">
                    Retype New Password&nbsp;
                </td>
                <td valign="top" nowrap="nowrap">
                    <asp:TextBox ID="txtPassword2" TextMode="Password" runat="server" MaxLength="20"
                        Width="143px" TabIndex="10004" onfocus="this.value=''" onblur=""></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td width="26%" valign="top">
                    &nbsp;
                </td>
                <td valign="top">
                    <asp:RequiredFieldValidator ID="VldtxtPassword2Required" runat="server" ControlToValidate="txtCurrentPassword"
                        SetFocusOnError="true" ErrorMessage="<b>Confirm Password</b> is required." ValidationGroup="sendUPP"
                        Display="Dynamic"></asp:RequiredFieldValidator>
                    <asp:CompareValidator ID="vldtxtPasswordCompare" runat="server" Text="" ControlToCompare="txtPassword"
                        ValidationGroup="sendUPP" ControlToValidate="txtPassword2" Display="Dynamic"
                        ErrorMessage="<b>Confirm Password</b> does not match <b>Password</b>."></asp:CompareValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    &nbsp;
                </td>
                <td valign="top">
                    <asp:ImageButton ID="btnSaveUPP" runat="server" ImageUrl="saveChanges.ccom" AlternateText="Save Changes"
                        TabIndex="10005" OnClientClick="hideRoundBox();" ValidationGroup="sendUPP" />
                    <asp:ImageButton ID="btnResetUPP" runat="server" ImageUrl="reset.ccom" AlternateText="Reset"
                        TabIndex="10006" CommandName="btnReset_Click" CausesValidation="true" />
                </td>
            </tr>
        </table>
        <br />
    </div>
</asp:Panel>
<!-- panel displaying otehr account sections -->
<asp:Panel ID="otherAccountSettings" runat="server" Visible="true" DefaultButton="btnSaveOAS">
    <div class="innerbox" style="width: 650px!important;">
        <p class="innerHeader2">
            Other Account Settings</p>
        <div id="summaryBox2" style="padding: 10px;">
            <asp:Label ID="lblErrorOAS" runat="server" Visible="false" ForeColor="red"></asp:Label>
            <asp:Label ID="ltrMessageOAS" runat="server" ForeColor="red"></asp:Label>
        </div>
        
        <p>
            
            <asp:Label ID="lblOASIntroText" runat="server"></asp:Label>
            
        </p>
        
        <span style="padding-left: 10px; line-height: 2em;"><font color="red">*Required Fields</font></span>
        <table width="95%" border="0" cellpadding="0" cellspacing="0" style="margin-top: 10px;
            line-height: 22px; margin-left: 20px;">
            <tr>
                <td width="26%" valign="top" style="text-align: right;">
                    <font color="red">*</font>Security Question&nbsp;
                </td>
                <td valign="top">
                    <asp:DropDownList ID="ddlQuestion" runat="server" Width="180px" TabIndex="10007">
                    </asp:DropDownList>
                    &nbsp;<a href="../customers/support.aspx?SupportArticleID=1934" target="_blank" tabindex="19999">Why
                        do I need one?</a>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    &nbsp;
                </td>
                <td valign="top">
                    <asp:RequiredFieldValidator ID="vldQuestion" runat="server" Display="Dynamic"  ErrorMessage="<b>Security Question</b> is a required field." 
                    ControlToValidate="ddlQuestion" SetFocusOnError="True" 
                    InitialValue="Choose One..." ValidationGroup="sendOAS"></asp:RequiredFieldValidator> 
                </td>
            </tr>
            <tr>
                <td valign="top" style="text-align: right;">
                    <font color="red">*</font>Security Answer&nbsp;
                </td>
                <td valign="top">
                    <asp:TextBox ID="txtAnswer" runat="server" Width="180px" TabIndex="10008"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    &nbsp;
                </td>
                <td valign="top">
                    <asp:RequiredFieldValidator ID="vldAnswerRequired" runat="server" ControlToValidate="txtAnswer"
                        Display="Dynamic" ErrorMessage="<b>Security Answer</b> is a required field." ValidationGroup="sendOAS"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td valign="top" style="text-align: right;">
                    <font color="red">*</font>Contact Email&nbsp;
                </td>
                <td valign="top">
                    <asp:TextBox ID="txtEmail" runat="server" Width="180px" TabIndex="10009"></asp:TextBox>
                    &nbsp;<a href="../customers/support.aspx?SupportArticleID=1085#charter" target="_blank">Why
                        do I need one?</a>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    &nbsp;
                </td>
                <td valign="top">
                    <asp:RequiredFieldValidator ID="vldEmailRequired" runat="server" ValidationGroup="sendOAS"
                        ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage="<b>Contact Email Address</b> is required."></asp:RequiredFieldValidator>
                    <asp:RegularExpressionValidator ID="vldEmailRegEx" runat="server" ControlToValidate="txtEmail"
                        Display="Dynamic" ErrorMessage="<b>Contact Email Address</b> is not valid."
                        ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"></asp:RegularExpressionValidator>
                </td>
            </tr>
            <tr>
                <td valign="top">
                    &nbsp;
                </td>
                <td valign="top">
                    <asp:ImageButton ID="btnSaveOAS" runat="server" ImageUrl="saveChanges.ccom" AlternateText="Save Changes"
                        TabIndex="10010" OnClientClick="hideRoundBox();" />
                    <asp:ImageButton ID="btnResetOAS" runat="server" ImageUrl="reset.ccom" AlternateText="Reset"
                        TabIndex="10011" CommandName="btnReset_Click" />
                </td>
            </tr>
        </table>
        <br />
    </div>
</asp:Panel>
