<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Driver2/Application/Application2.master" CodeBehind="EmploymentHistory.aspx.vb" Inherits="Web.EmploymentHistory1" %>
<%@ MasterType VirtualPath="Application2.Master" %>
<%@ Register TagPrefix="ctrl" Namespace="Web" Assembly="Web" %>
<%@ Register Src="~/_include/controls/StatePicker.ascx" TagPrefix="ctrl" TagName="StatePicker" %>
<%@ Register Src="~/_include/controls/YesNoPicker.ascx" TagPrefix="ctrl" TagName="YesNoPicker" %>
<asp:Content ID="Content1" ContentPlaceHolderID="phContent" runat="server">

    <h1>Employment History</h1>

    <asp:CustomValidator ID="valGaps" runat="server" Display="None" />
    <asp:PlaceHolder ID="phConfirmGaps" runat="server" Visible="false">
        <div class="error box small">
            <p>There are gaps in your employment history. Review your entries and confirm this is correct.</p>
            <div class="buttonStrip">
                <asp:Button ID="btnCancelGaps" runat="server" Text="Close" />
                <asp:Button ID="btnConfirmGaps" runat="server" CssClass="default" Text="Confirm" />
            </div>
        </div>
    </asp:PlaceHolder>

    <p>All driver applicants must provide the following information on all work references during the preceding <em>three (3) years</em> from the
date application is submitted. Those drivers applying to operate a commercial motor vehicle as defined in <em>§383.5 (requiring a CDL)</em>
shall provide <em>ten (10) years</em> of employment history. <em>NOTE: Please list companies in reverse order starting with the most recent and
leave no gaps in employment history.</em></p>

             <h1>Safety Performance History Investigation &mdash; Previous USDOT Regulated Employers</h1>

            <p>I hereby specifically authorize you to release the following information to 
    the specified company and their agents for the purposes of investigation as required by §391.23 and §40.321(b) of the Federal Motor Carrier Safety
    Regulations. You are hereby released from any and all liability which may result from furnishing such information.</p>

    <ctrl:FormList ID="rptHistory" runat="server" AddText="Add Employer"><ItemTemplate>
        <asp:HiddenField ID="hidId" runat="server" Value="0" />
        <section>
            <div style="float: right; display: inline-block;">
                <asp:Button ID="btnRemove" runat="server" 
                    CausesValidation="false" OnClick="btnRemove_Click" 
                    Text="Remove" />
            </div>
            <h1>Previous Employer <%# Container.ItemIndex + 1 %></h1>

            <ul class="formFields">
                <li class="big">
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="txtName"
                        Text="required" CssClass="required" Display="Dynamic" />
                    <asp:Label runat="server" AssociatedControlID="txtName" Text="Company Name" />
                    <asp:TextBox ID="txtName" runat="server" MaxLength="128" />
                </li>
            </ul>

            <ul class="formFields">
                <li class="big">
                    <asp:Label runat="server" AssociatedControlID="txtStreet" Text="Address" />
                    <asp:TextBox ID="txtStreet" runat="server" MaxLength="128" placeholder="Street Address" />
                </li>
                <li class="left">
                    <asp:Label runat="server" AssociatedControlID="txtCity" Text="City" />
                    <asp:TextBox ID="txtCity" runat="server" MaxLength="50" placeholder="City" />
                </li>
                <li class="left">
                    <asp:Label runat="server" AssociatedControlID="ddlState" Text="State" />
                    <ctrl:StatePicker ID="ddlState" runat="server" />
                </li>
                <li class="right">
                    <asp:Label runat="server" AssociatedControlID="txtZip" Text="Zip" />
                    <asp:TextBox ID="txtZip" runat="server" MaxLength="50" TextMode="Number" placeholder="Zip Code" />
                </li>
            </ul>

            <ul class="formFields">
                <li class="big">
                    <asp:Label runat="server" AssociatedControlID="txtContact" Text="Contact" />
                    <asp:TextBox ID="txtContact" runat="server" MaxLength="128" />
                </li>
                <li>
                    <asp:Label runat="server" AssociatedControlID="txtPhone" Text="Phone" />
                    <asp:TextBox ID="txtPhone" runat="server" MaxLength="50" TextMode="Phone" />
                </li>
                <li>
                    <asp:Label runat="server" AssociatedControlID="txtFax" Text="Fax" />
                    <asp:TextBox ID="txtFax" runat="server" MaxLength="50" TextMode="Phone" />
                </li>
            </ul>

            <ul class="formFields">
                <li>
                    <asp:RequiredFieldValidator runat="server" ControlToValidate="txtFrom"
                        Text="required" CssClass="required" Display="Dynamic" />
                    <asp:Label runat="server" AssociatedControlID="txtFrom" Text="Employed From" />
                    <asp:TextBox ID="txtFrom" runat="server" MaxLength="50" TextMode="Date" />
                    <asp:Label runat="server" AssociatedControlID="txtTo" Text="To" />
                    <asp:TextBox ID="txtTo" runat="server" MaxLength="50" TextMode="Date" />
                </li>
                <li>
                    <asp:Label runat="server" AssociatedControlID="txtMonths" Text="Total months" />
                    <asp:TextBox ID="txtMonths" runat="server" MaxLength="50" TextMode="Number" />
                    <script type="text/javascript">
                        (function () {
                            var txtFrom = $('#<asp:Literal ID="litId_txtFrom" runat="server"/>');
                            var txtTo = $('#<asp:Literal ID="litId_txtTo" runat="server"/>');
                            var txtMonths = $('#<asp:Literal ID="litId_txtMonths" runat="server"/>');
                            var setTotalMonths = function () {
                                var start = new Date(txtFrom.val());
                                var end = new Date(txtTo.val());
                                var difference = end.getMonth() - start.getMonth() + 12 * (end.getFullYear() - start.getFullYear());
                                txtMonths.val(Math.abs(difference));
                            };
                            txtFrom.change(setTotalMonths);
                            txtTo.change(setTotalMonths);
                            txtFrom.on('input', setTotalMonths);
                            txtTo.on('input', setTotalMonths);
                        })();
                    </script>
                </li>
                <li class="big">
                    <asp:Label runat="server" AssociatedControlID="txtPosition" Text="Position(s) Held" />
                    <asp:TextBox ID="txtPosition" runat="server" MaxLength="128" />
                </li>
            </ul>

            <ul class="formFields">
                <li>
                    <asp:Label runat="server" AssociatedControlID="ynSubjectFMCSR" CssClass="long"
                        Text="Were you subject to the Federal Motor Carrier Safety Regulations while employed by this employer?" />
                    <ctrl:YesNoPicker ID="ynSubjectFMCSR" runat="server" />
                </li>
                <li>
                    <asp:Label runat="server" AssociatedControlID="ynSafetySensitive" CssClass="long"
                        Text="Was this job designated as a safety sensitive function in any D.O.T. regulated mode subject to alcohol and controlled substance testing requirements as required by 49 CFR Part 40?" />
                    <ctrl:YesNoPicker ID="ynSafetySensitive" runat="server" />
                </li>
            </ul>

            <ul class="formFields">
                <li class="left">

                    <asp:Label runat="server" AssociatedControlID="ddlReasonLeft" Text="Reason for Leaving" />
                    <asp:DropDownList ID="ddlReasonLeft" runat="server">
                        <asp:ListItem Text="" />
                        <asp:ListItem Text="Lay Off" />
                        <asp:ListItem Text="Resignation" />
                        <asp:ListItem Text="Termination" />
                        <asp:ListItem Text="Other" />
                    </asp:DropDownList>

                    <ul class="dependent" data-dependency="<%# Container.FindControl("ddlReasonLeft").ClientID %>" data-value="Other">
                        <li class="big">
                            <ctrl:RequiredDependentFieldValidator runat="server" 
                                ControlToValidate="txtReasonLeft" DependencyControl="ddlReasonLeft" WhenValue="Other"
                                Text="required" Display="Dynamic" CssClass="required" />
                            <asp:Label runat="server" AssociatedControlID="txtReasonLeft" Text="If other, please describe" />
                            <asp:TextBox ID="txtReasonLeft" runat="server" MaxLength="121" />
                        </li>
                    </ul>

                </li>
                <li class="big">
                    <asp:Label runat="server" AssociatedControlID="txtExplanation" Text="Explanation" />
                    <asp:TextBox ID="txtExplanation" runat="server" TextMode="MultiLine" data-maxlength="512" />
                </li>
            </ul>

        </section>
    </ItemTemplate></ctrl:FormList>

    <section>
        <ul class="formFields">
            <li>
                <asp:RequiredFieldValidator runat="server" ControlToValidate="ynComplete"
                    Text="required" Display="Dynamic" CssClass="required" />
                <asp:CustomValidator ID="valComplete" runat="server" ControlToValidate="ynComplete"
                    Text="required" Display="Dynamic" CssClass="required" />
                <asp:Label ID="lblComplete" runat="server" AssociatedControlID="ynComplete" Text="" />
                <ctrl:YesNoPicker ID="ynComplete" runat="server" />
            </li>
        </ul>
    </section>

</asp:Content>
