@using SharpConnector.Models;
@using SharpConnector.Constants;
@using System.Configuration;
@model HomeVM

@using (Html.BeginForm("Save", "Home", FormMethod.Post, new { @id = "mainForm" }))
{
    <div class="inner_wrapper">
        <table cellpadding="5" align="center">
            <tbody>
                <tr>
                    <td colspan="4" class="text-center">
                        Fax To
                        @Html.TextBoxFor(m => m.MainRecipient.Address)
                        <button type="button" onclick="navigateTo('@Url.Action("AddRecipient", "AddressBook")');" class="right">
                            <img src="@Url.Content("~/Content/Images/user-plus-solid.png")" width="25" />
                        </button>
                    </td>
                </tr>
            </tbody>
        </table>
    </div>

    <div id="tbl_faxInfo_wrapper" class="inner_wrapper stretch_to_bottom">
        <h4 onmousedown="toggleTable('tbl_faxInfo')">
            Fax information - <span class="optional">optional</span>
            <img src="@Url.Content("~/Content/Images/ico-edit.png")" width="22" />
        </h4>
        <div id="tbl_faxInfo">
            <table cellpadding="8">
                <tbody>
                    <tr>
                        <td>
                            <label class="full-label">Name</label>
                            @Html.TextBoxFor(m => m.MainRecipient.Name)
                        </td>
                        <td>
                            <label class="full-label">Subject</label>
                            @Html.TextBoxFor(m => m.Subject)
                        </td>
                    </tr>
                    <tr>
                        <td valign="top">
                            <label class="full-label">Company</label>
                            @Html.TextBoxFor(m => m.MainRecipient.Company)
                            <br />
                            <div id="priority_wrapper">
                                <label>Priority</label>
                                @Html.EnumDropDownListFor(m => m.Priority)
                            </div>
                        </td>
                        <td valign="top">
                            <label class="full-label">Note</label>
                            @Html.TextAreaFor(m => m.Note, new { @rows = "3" })
                        </td>
                    </tr>
                    <tr>
                        <td></td>
                        <td>
                            @Html.CheckBoxFor(m => m.Preview, new { @id = "preview" })
                            <label for="preview">
                                <span>Hold for Preview</span>
                            </label>
                        </td>
                    </tr>
                </tbody>
            </table>
        </div>
    </div>
}
<script>
    /* Set inner content height */
    $('#tbl_faxInfo_wrapper').style.height = (window.innerHeight - $('#tbl_faxInfo_wrapper').offsetTop - 45) + 'px';      

    // ------------------------------------------------------------------------------
    function SubmitForm() {
        var isSendInput = document.createElement("input");
        isSendInput.type = "hidden";
        isSendInput.name = "IsSend";
        isSendInput.value = "true";
        $('#mainForm').appendChild(isSendInput);

        $('#mainForm').submit();
    }
</script>